Random crashes and NPF glitches (0.4.5)

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

DmitryKo
Engineer
Engineer
Posts: 85
Joined: 16 Feb 2006 15:30
Location: Moscow, Russia

Random crashes and NPF glitches (0.4.5)

Post by DmitryKo »

I have an autosave from a failed network game. I've loaded it as a standalone game and switched to Player3 through the cheat screen, but the game crashes after 10 or so minutes, mosty when autosaving or when I hit save myself, and one or two ships can't find the way to an island-situated destinations (Wutfingport), even thougn NPF is turned on and other vehicles are doing fine, even those that were lost with the default AI.

The savegame and the confing file are included below.
Attachments
openttd.cfg
(3.58 KiB) Downloaded 122 times
Chook Ltd., 17th Jun 1994.sav
(440.01 KiB) Downloaded 164 times
DmitryKo
Engineer
Engineer
Posts: 85
Joined: 16 Feb 2006 15:30
Location: Moscow, Russia

Re: Random crashes and NPF glitches (0.4.5)

Post by DmitryKo »

I just tried to load the savegame one more time and Ship 21 of Chook Ltd. still circles around the island helplessly, as if it's using the old pathfinding, and the game still crashes in 5-10 minutes through the gameplay. Could someone load it and see what happens?
Last edited by DmitryKo on 21 Feb 2006 20:05, edited 1 time in total.
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

Ships are kinda stupid so you are much better off also giving bouy-directions to the boat on the way back.

Still researching the assumed crash, it hasn't happened so far. Did you do anything special? I switched to player #3 and am watching his boat #21 being all braindeaddy and hogging game-resources.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
DmitryKo
Engineer
Engineer
Posts: 85
Joined: 16 Feb 2006 15:30
Location: Moscow, Russia

Post by DmitryKo »

Darkvater wrote:Ships are kinda stupid so you are much better off also giving bouy-directions to the boat on the way back.

Still researching the assumed crash, it hasn't happened so far. Did you do anything special? I switched to player #3 and am watching his boat #21 being all braindeaddy and hogging game-resources.

But the Ship 21 does have a buoy in the orders! :shock: OK, I've skipped the current destination so it goes through the buoy, but it still seems to hog the resources, as the game stutters a lot. Maybe some data got corrupt during the Network Autosave from the failed server... the Ship 21 was built long after that moment though.

I did nothing special, apart from loading the second-latest autosave after the game routinely crashed. Can it be the patch options - I didn't edit the CFG manually, but maybe some are incompatible...

I think I'm going to install OpenTTD on a yet different Windows 2000 PC and also to my Windows XP x64 partition, try loading some savegames and see what happens. I'm currently running it on a Pentium 4 531 (with EMT64) under Windows XP SP2 witn NX enabled, maybe that's a part of the problem...


BTW, there was also a similar NPF glitch in a different game - some ships were stuck, although I created no less than 3 buoys and placed then in the orders. Deleting and recreating the orders didn't help, so I had to sell most ships, then give completely different (but equally complex) orders to a remaining one, and it worked... All the other ships were just fine even without the bouys, over the exact same route.

I also noticed a kind of glitch with NPF setting - it looked like the setting was reversed after joining and disconnection a network server and then loading the savegame in standalone mode... I'll try to reproduce it as well.
DmitryKo
Engineer
Engineer
Posts: 85
Joined: 16 Feb 2006 15:30
Location: Moscow, Russia

Post by DmitryKo »

DmitryKo wrote:I think I'm going to install OpenTTD on a yet different Windows 2000 PC and also to my Windows XP x64 partition, try loading some savegames and see what happens. I'm currently running it on a Pentium 4 531 (with EMT64) under Windows XP SP2 witn NX enabled, maybe that's a part of the problem...


Here's what I've found in regard to crashes.

Celeron 1.7GHz, 512 MB under Windows 2000 SP4: not a single crash, CPU load 15 to 30%

P4 531 3GHz (HyperThreading, EM64T), Windows XP x64: has thrown an exception after 10 minutes of gameplay, CPU time 10 to 20% (which is actually twice as much because HT is enabled, so it's a 2-way SMP machine)

P4 531 3GHz, Windows XP SP2 (32-bit) running with hardware DEP (NX/PAE mode): has thrown an exception after 30 seconds into the game, then crashed silently every 10 minutes, CPU time 10 to 30% (again, multiply it by 2)


No crashes when NPF is disabled.
Attachments
crash_wxp.txt
Crash log under Windows XP Pro SP2
(6.65 KiB) Downloaded 186 times
crash_x64.txt
Crash log under Windows XP Pro x64 Edition
(6.05 KiB) Downloaded 160 times
Screenshot of the system properties for x64
Screenshot of the system properties for x64
OTTDx64.png (25.95 KiB) Viewed 4815 times
Last edited by DmitryKo on 23 Feb 2006 00:07, edited 1 time in total.
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

Hmm if x64 crashes but x32 doesn't and both don't with NPF disabled, NPF is clearly faulty with some buffer or wrongly assumed pointer-size?

I have no 64bit machine though to do any debugging :(

You have used the 0.4.5 on the SourceForge page or compiled it yourself?
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
DmitryKo
Engineer
Engineer
Posts: 85
Joined: 16 Feb 2006 15:30
Location: Moscow, Russia

Post by DmitryKo »

Darkvater wrote:Hmm if x64 crashes but x32 doesn't and both don't with NPF disabled, NPF is clearly faulty with some buffer or wrongly assumed pointer-size?

I have no 64bit machine though to do any debugging :(

You have used the 0.4.5 on the SourceForge page or compiled it yourself?
I'm using a precompiled binary from SourceForge.

OpenTTD does crash under 32-bit XP SP2 - it throws just the same exception C0000005 (EXCEPTION_ACCESS_VIOLATION) at very similar address in both 32-bit XP SP2 and XP x64, as apparent from the two crashlogs (sorry that haven't made it explicitly clear - I was just assuming that my referring to "XP SP2" is sufficient, because XP x64 is technically a client version of Windows 2003 SP1).

Yes, it seems like either a data corruption in the savegame, a really rare bug in NPF code, or the combination of both, that causes an illegal memory reference.


I guess the cause is hardware Data Execution Prevention enabled in XP SP2, which runs in a PAE kernel using the NX bit capability of recent processors, and a very similar protection scheme used by Windows X64, again based on NX bit, so both XP SP2 and XP x64 are able to catch more invalid accesses than was previously possible. This is unlike Windows 2000 and XP pre-SP2 which don't have this advanced protection, so OpenTTD was able to run fine.

I'd guess the best idea would be to complie a debug build and run it under XP with SP2 and PAE/DEP enabled, so to be able to check the actual code and data in an integrated debugger.

I would do it myself, since it seems I'm the only one here who has the hardware DEP enabled ;), but the problem is I don't have any tools except a beta of free and limited VC++ 2005 Express :( It could probably be hacked to generate and debug non-managed code, but I still have to download and install DirectX SDK and Platform SDK to be able to make a build... maybe I'll give it a try a bit later.
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

Ah, well I don't have any NX machine so :)

I think the free version of VS2005 might even work. You don't need any platformSDK or DirectxSDK because that is already included. At least it was with VS2003 and I don't think they removed it.

Checking this would be great though :)

I've opened a bugreport here: http://bugs.openttd.org/task/57
Through the crashlog and the generated mapfile I figured out where the thing crashed, but that's about it :P
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
DmitryKo
Engineer
Engineer
Posts: 85
Joined: 16 Feb 2006 15:30
Location: Moscow, Russia

Post by DmitryKo »

Darkvater wrote:I think the free version of VS2005 might even work. You don't need any platformSDK or DirectxSDK because that is already included. At least it was with VS2003 and I don't think they removed it.
If only... it's not a "free version of VS 2005" but rather a "free VS 2005 Express Edition" for beginners who supposed to build managed code only, so there's no Platform SDK included as in "full" VS 2005, only basic "MSDN Library for VS 2005 Express Edition" docs for .NET Framework.

Visual C++ 2005 Express Edition is a slight exception - it does include both managed and native C runtimes and docs, so it can build and debug native x86 applications, provided you obtain the Platform SDK.
I've opened a bugreport here: http://bugs.openttd.org/task/57
Through the crashlog and the generated mapfile I figured out where the thing crashed, but that's about it :P


OK. I've got Platform SDK and VC++ 2005 EE now builds native Windows code, so I can try different compiler options and see if there's still an exception...


BTW, I've spent almost all day trying get the build :(. First, the SDK installer didn't update the Express settings, unlike more recent DirectX SDK installer, so I had to add the directories manually... that was the easy part.

Then I wasted a fair amound of time figuring why there are all sorts of bizarre warnings and errors for POSIX runtime functions and inline/_cdecl specifiers, until I noticed that even Platform SDK headers won't compile! :? I has almost hit myself in the head :x and then I tried to compile lame 3.97 from a VC6 project and it flew right away. It turned out the import logic of VC.NET/VC2003 projects defaults to ANSI C conformance, /Za, and treating all warnings as errors, /WX! DOH! :shock:

And the last thing, it turned out that single-threaded runtime libraries are not shipped with VS2005 anymore, so the precompiled zlib and pnglib won't even link and I need to include the sources! And of course it's got all messed up, because pnglib wouldn't link wih zlibstat and openttd wouldn't link with zlib... :twisted: so I had to disable WITH_PNG... Must be a bunch of some very different calling conventions carefully defined somewhere in between all of those #defines! LOL What a day...

I guess it all seems a bit trivial, but I'm really noob to VC++ ... :oops: :P
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

I donnu what you did but I never had such big problems :)
I have a VS2005 Professional lying around and tried it. Copied over header files, libpng and zlib from useful.zip and just hit compile after silencing the 4996 warnings with a #pragma. And of course ignore the LIBC library cause it won't link...stupid program.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
DmitryKo
Engineer
Engineer
Posts: 85
Joined: 16 Feb 2006 15:30
Location: Moscow, Russia

Post by DmitryKo »

Darkvater wrote:Copied over header files, libpng and zlib from useful.zip and just hit compile after silencing the 4996 warnings with a #pragma. And of course ignore the LIBC library cause it won't link...stupid program.
Well, I understood it like you can't mix different mode libraries, and there are no single-threaded runtime libraries in Express edition... gotta try /NODEFAULTLIB: some later.


Back to the topic. I've compiled some release builds and they are as stable as rock under both XP 32-bit and XP x64 :?, even with some extreme compiler optimizations. I didn't even bother testing debug builds much. Maybe it's the rare case when running a faulty program under a debugger makes it work? :D OK, just kidding...


So, I guess I need external .pdb symbols for the SourceForge binary :roll:
User avatar
Brianetta
Tycoon
Tycoon
Posts: 2567
Joined: 15 Oct 2003 22:00
Location: Jarrow, UK
Contact:

Post by Brianetta »

PGP fingerprint: E66A 9D58 AA10 E967 41A6 474E E41D 10AE 082C F3ED
DmitryKo
Engineer
Engineer
Posts: 85
Joined: 16 Feb 2006 15:30
Location: Moscow, Russia

Post by DmitryKo »

Well, I actually didn't attach the debugger to my own 0.4.5 binary, so I didn't voilate the Uncertainty Principle :P

I tried the binary from the latest nightly build r3661 and it seems to be stable as well...
DmitryKo
Engineer
Engineer
Posts: 85
Joined: 16 Feb 2006 15:30
Location: Moscow, Russia

Post by DmitryKo »

I've got the 0.4.5 release .EXE with symbols from Darkvater, and have got some really weird results with random breaks at various places...

One time, it broke in the process of threaded autosave while trying to clean the memory pool, calling CleanPool(_ts.save) with a NULL pointer, even though _ts.save was OK:
Call stack:
free(void * pBlock=0x01c4bff8) Line 101 + 0xe bytes
> CleanPool(MemoryPool * pool=0x00000000) Line 20 + 0xb bytes
UnInitMem() Line 940
SaveFileToDisk(void * arg=0x00000000) Line 1338
Proxy(void * arg=0x00ddf9d0) Line 109 + 0xa bytes
- _ts {save=0x004c664c count=2086489 ff_state='' ...} ThreadedSave
- save 0x004c664c {name=0x004c664c "Savegame" max_blocks=500 block_size_bits=17 ...} MemoryPool *
+ name 0x004c664c "Savegame" const unsigned char [10]
max_blocks 500 const unsigned int
block_size_bits 17 const unsigned int
item_size 1 const unsigned int
new_block_proc 0x00000000 void (unsigned int)*
current_blocks 16 unsigned int
total_items 2097152 unsigned int
- blocks 0x01c28ff8 unsigned char * *
- 0x01c4bff8 "MAPS" unsigned char *
77 'M' unsigned char
count 2086489 unsigned int
ff_state 1 '␁' unsigned char
saveinprogress 1 '␁' unsigned char
cursor 0 unsigned int
It broke 2 times in total when trying to malloc 16 more bytes for a node in HashSet(), and again, NPFRouteInternal() was calling AyStarMain(&_npf_aystar) and the pointer to _npf.asystar was NULL as well
_heap_alloc(unsigned int size=16) Line 211 + 0xf bytes
_nh_malloc(unsigned int size=16, int nhFlag=0) Line 113
malloc(unsigned int size=16) Line 54 + 0xf bytes
> Hash_Set(Hash * h=0x00000000, unsigned int key1=0, unsigned int key2=1, void * value=0x022dcfb0) Line 698 + 0x7 bytes
AyStarMain_ClosedList_Add(AyStar * aystar=0x004d2618, PathNode * node=0x0012faa4) Line 36 + 0x15 bytes
AyStarMain_Loop(AyStar * aystar=0x00000000) Line 162
AyStarMain_Main(AyStar * aystar=0x00000000) Line 226 + 0x8 bytes
NPFRouteInternal(AyStarNode * start1=0x0012fb54, AyStarNode * start2=0x0012fae0, NPFFindStationOrTileData * target=0x0012fc1c, int (AyStar *, OpenListNode *)* target_proc=0x004182bf, int (AyStar *, AyStarNode *, OpenListNode *)* heuristic_proc=0x00000000, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE, unsigned int reverse_penalty=0) Line 688
NPFRouteToStationOrTileTwoWay(unsigned int tile1=0, Trackdirs trackdir1=TRACKDIR_DIAG1_NE, unsigned int tile2=0, Trackdirs trackdir2=TRACKDIR_DIAG1_NE, NPFFindStationOrTileData * target=0x0012fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 714 + 0x52 bytes
NPFRouteToStationOrTile(unsigned int tile=42762, Trackdirs trackdir=1244188, NPFFindStationOrTileData * target=0x0012fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 719 + 0x1d bytes
ChooseShipTrack(Vehicle * v=0x00000000, unsigned int tile=201368842, int enterdir=3, unsigned int tracks=8) Line 546 + 0x1d bytes
ShipController(Vehicle * v=0x00000000) Line 752
CallVehicleTicks() Line 616 + 0xc bytes
And two times in clear_Hash
> clear_Hash(Hash * h=0x00000000, unsigned char free_values='') Line 574 + 0x8 bytes
AyStarMain_Clear(AyStar * aystar=0x00000000) Line 205 + 0xd bytes
AyStarMain_Main(AyStar * aystar=0x00000000) Line 240
NPFRouteInternal(AyStarNode * start1=0x0013fb54, AyStarNode * start2=0x0013fae0, NPFFindStationOrTileData * target=0x0013fc1c, int (AyStar *, OpenListNode *)* target_proc=0x004182bf, int (AyStar *, AyStarNode *, OpenListNode *)* heuristic_proc=0x00000000, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE, unsigned int reverse_penalty=0) Line 688
NPFRouteToStationOrTileTwoWay(unsigned int tile1=0, Trackdirs trackdir1=TRACKDIR_DIAG1_NE, unsigned int tile2=0, Trackdirs trackdir2=TRACKDIR_DIAG1_NE, NPFFindStationOrTileData * target=0x0013fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 714 + 0x52 bytes
NPFRouteToStationOrTile(unsigned int tile=46819, Trackdirs trackdir=1309724, NPFFindStationOrTileData * target=0x0013fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 719 + 0x1d bytes
ChooseShipTrack(Vehicle * v=0x00000000, unsigned int tile=151041251, int enterdir=3, unsigned int tracks=42) Line 546 + 0x1d bytes
ShipController(Vehicle * v=0x00000000) Line 752
One time it probably received a null vehicle pointer on GetVehicle from the vehicle pool (not shown in the stack frame because it's inline):
_nh_malloc(unsigned int size=14090240, int nhFlag=0) Line 113
free(void * pBlock=0x00e6de78) Line 101 + 0xe bytes
> Clear_Hash(Hash * h=0x00000000, unsigned char free_values='') Line 575 + 0x6 bytes
AyStarMain_Clear(AyStar * aystar=0x00000000) Line 205
AyStarMain_Main(AyStar * aystar=0x00000000) Line 240
NPFRouteToDepotTrialError(unsigned int tile=153085, Trackdirs trackdir=TRACKDIR_DIAG2_SE, TransportTypes type=TRANSPORT_RAIL, Owner owner=0, RailTypes railtype=1244208) Line 837
FindClosestShipDepot(const Vehicle * v=0x00000000) Line 71 + 0x17 bytes
CheckIfShipNeedsService(Vehicle * v=0x00000000) Line 106 + 0x7 bytes
OnNewDay_Ship(Vehicle * v=0x00000000) Line 135
RunVehicleDayProc(unsigned int daytick=0) Line 492
IncreaseDate() Line 511
Then it broke numerous times on malloc() of 24 bytes in AyStarMain_OpenList_Add(), which I don't get at all...
_heap_alloc(unsigned int size=24) Line 211 + 0xf bytes
_nh_malloc(unsigned int size=24, int nhFlag=0) Line 113
malloc(unsigned int size=24) Line 54 + 0xf bytes
> AyStarMain_OpenList_Add(AyStar * aystar=0x004d2618, PathNode * parent=0x00e5df50, AyStarNode * node=0x004d2668, int f=3957, int g=3075) Line 64 + 0x7 bytes
AyStarMain_CheckTile(AyStar * aystar=0x00000000, AyStarNode * current=0x00000000, OpenListNode * parent=0x00000f75) Line 128
AyStarMain_Loop(AyStar * aystar=0x00000000) Line 167 + 0xb bytes
AyStarMain_Main(AyStar * aystar=0x00000000) Line 226 + 0x8 bytes
NPFRouteInternal(AyStarNode * start1=0x0012fb54, AyStarNode * start2=0x0012fae0, NPFFindStationOrTileData * target=0x0012fc1c, int (AyStar *, OpenListNode *)* target_proc=0x004182bf, int (AyStar *, AyStarNode *, OpenListNode *)* heuristic_proc=0x00000000, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE, unsigned int reverse_penalty=0) Line 688
NPFRouteToStationOrTileTwoWay(unsigned int tile1=0, Trackdirs trackdir1=TRACKDIR_DIAG1_NE, unsigned int tile2=0, Trackdirs trackdir2=TRACKDIR_DIAG1_NE, NPFFindStationOrTileData * target=0x0012fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 714 + 0x52 bytes
NPFRouteToStationOrTile(unsigned int tile=47330, Trackdirs trackdir=1244188, NPFFindStationOrTileData * target=0x0012fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 719 + 0x1d bytes
ChooseShipTrack(Vehicle * v=0x00000000, unsigned int tile=201373410, int enterdir=3, unsigned int tracks=42) Line 546 + 0x1d bytes
ShipController(Vehicle * v=0x00000000) Line 752
CallVehicleTicks() Line 616 + 0xc bytes
_heap_alloc(unsigned int size=24) Line 211 + 0xf bytes
_nh_malloc(unsigned int size=24, int nhFlag=0) Line 113
malloc(unsigned int size=24) Line 54 + 0xf bytes
> AyStarMain_OpenList_Add(AyStar * aystar=0x004d2618, PathNode * parent=0x00e75188, AyStarNode * node=0x004d2688, int f=7054, int g=6530) Line 64 + 0x7 bytes
AyStarMain_CheckTile(AyStar * aystar=0x00000000, AyStarNode * current=0x00000000, OpenListNode * parent=0x00001b8e) Line 128
AyStarMain_Loop(AyStar * aystar=0x00000000) Line 167 + 0xb bytes
AyStarMain_Main(AyStar * aystar=0x00000000) Line 226 + 0x8 bytes
NPFRouteInternal(AyStarNode * start1=0x0012fb54, AyStarNode * start2=0x0012fae0, NPFFindStationOrTileData * target=0x0012fc1c, int (AyStar *, OpenListNode *)* target_proc=0x004182bf, int (AyStar *, AyStarNode *, OpenListNode *)* heuristic_proc=0x00000000, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE, unsigned int reverse_penalty=0) Line 688
NPFRouteToStationOrTileTwoWay(unsigned int tile1=0, Trackdirs trackdir1=TRACKDIR_DIAG1_NE, unsigned int tile2=0, Trackdirs trackdir2=TRACKDIR_DIAG1_NE, NPFFindStationOrTileData * target=0x0012fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 714 + 0x52 bytes
NPFRouteToStationOrTile(unsigned int tile=83535, Trackdirs trackdir=1244188, NPFFindStationOrTileData * target=0x0012fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 719 + 0x1d bytes
ChooseShipTrack(Vehicle * v=0x00000000, unsigned int tile=134301264, int enterdir=2, unsigned int tracks=37) Line 546 + 0x1d bytes
ShipController(Vehicle * v=0x00000000) Line 752
_heap_alloc(unsigned int size=24) Line 211 + 0xf bytes
_nh_malloc(unsigned int size=24, int nhFlag=0) Line 113
malloc(unsigned int size=24) Line 54 + 0xf bytes
> AyStarMain_OpenList_Add(AyStar * aystar=0x004d2618, PathNode * parent=0x01588078, AyStarNode * node=0x004d2678, int f=7409, int g=1270) Line 64 + 0x7 bytes
AyStarMain_CheckTile(AyStar * aystar=0x00000000, AyStarNode * current=0x00000000, OpenListNode * parent=0x00001cf1) Line 128
AyStarMain_Loop(AyStar * aystar=0x00000000) Line 167 + 0xb bytes
AyStarMain_Main(AyStar * aystar=0x00000000) Line 226 + 0x8 bytes
NPFRouteInternal(AyStarNode * start1=0x0013fb54, AyStarNode * start2=0x0013fae0, NPFFindStationOrTileData * target=0x0013fc1c, int (AyStar *, OpenListNode *)* target_proc=0x004182bf, int (AyStar *, AyStarNode *, OpenListNode *)* heuristic_proc=0x00000000, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE, unsigned int reverse_penalty=0) Line 688
NPFRouteToStationOrTileTwoWay(unsigned int tile1=0, Trackdirs trackdir1=TRACKDIR_DIAG1_NE, unsigned int tile2=0, Trackdirs trackdir2=TRACKDIR_DIAG1_NE, NPFFindStationOrTileData * target=0x0013fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 714 + 0x52 bytes
NPFRouteToStationOrTile(unsigned int tile=39213, Trackdirs trackdir=1309724, NPFFindStationOrTileData * target=0x0013fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=2, RailTypes railtype=INVALID_RAILTYPE) Line 719 + 0x1d bytes
ChooseShipTrack(Vehicle * v=0x00000000, unsigned int tile=134256942, int enterdir=2, unsigned int tracks=37) Line 546 + 0x1d bytes
ShipController(Vehicle * v=0x00000000) Line 752
CallVehicleTicks() Line 616 + 0xc bytes
_heap_alloc(unsigned int size=16) Line 211 + 0xf bytes
_nh_malloc(unsigned int size=16, int nhFlag=0) Line 113
malloc(unsigned int size=16) Line 54 + 0xf bytes
> Hash_Set(Hash * h=0x00000000, unsigned int key1=0, unsigned int key2=9, void * value=0x01b71040) Line 698 + 0x7 bytes
AyStarMain_OpenList_Add(AyStar * aystar=0x004d2618, PathNode * parent=0x015207c8, AyStarNode * node=0x004d2668, int f=14072, int g=5110) Line 71
AyStarMain_CheckTile(AyStar * aystar=0x00000000, AyStarNode * current=0x004d2618, OpenListNode * parent=0x000036f8) Line 128
AyStarMain_Loop(AyStar * aystar=0x00000000) Line 167 + 0xb bytes
AyStarMain_Main(AyStar * aystar=0x00000000) Line 226 + 0x8 bytes
NPFRouteInternal(AyStarNode * start1=0x0013fb54, AyStarNode * start2=0x0013fae0, NPFFindStationOrTileData * target=0x0013fc1c, int (AyStar *, OpenListNode *)* target_proc=0x004182bf, int (AyStar *, AyStarNode *, OpenListNode *)* heuristic_proc=0x00000000, TransportTypes type=TRANSPORT_WATER, Owner owner=6, RailTypes railtype=INVALID_RAILTYPE, unsigned int reverse_penalty=0) Line 688
NPFRouteToStationOrTileTwoWay(unsigned int tile1=0, Trackdirs trackdir1=TRACKDIR_DIAG1_NE, unsigned int tile2=0, Trackdirs trackdir2=TRACKDIR_DIAG1_NE, NPFFindStationOrTileData * target=0x0013fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=6, RailTypes railtype=INVALID_RAILTYPE) Line 714 + 0x52 bytes
NPFRouteToStationOrTile(unsigned int tile=115709, Trackdirs trackdir=1309724, NPFFindStationOrTileData * target=0x0013fc1c, TransportTypes type=TRANSPORT_WATER, Owner owner=6, RailTypes railtype=INVALID_RAILTYPE) Line 719 + 0x1d bytes
ChooseShipTrack(Vehicle * v=0x00000000, unsigned int tile=151110141, int enterdir=3, unsigned int tracks=42) Line 546 + 0x1d bytes
ShipController(Vehicle * v=0x00000000) Line 752
CallVehicleTicks() Line 616 + 0xc bytes
And the very last time:
> WndProcGdi(HWND__ * hwnd=0x0013fbc4, unsigned int msg=1, unsigned int wParam=0, long lParam=0) Line 207
FindClosestTrainDepot(Vehicle * v=0x00000000) Line 1783 + 0x2d bytes
CheckIfTrainNeedsService(Vehicle * v=0x0013fc10) Line 3390 + 0xb bytes
OnNewDay_Train(Vehicle * v=0x00000000) Line 3445
RunVehicleDayProc(unsigned int daytick=0) Line 492
IncreaseDate() Line 511
Any ideas?

[Edit] Cut some minor details and added some more stacks
Last edited by DmitryKo on 22 Mar 2006 15:19, edited 4 times in total.
KUDr
OpenTTD Developer
OpenTTD Developer
Posts: 219
Joined: 11 Jan 2006 21:36
Location: Czech Republic

Post by KUDr »

I had similar problems on my dual core amd (WinXP SP2). Autosave running in different thread caused sync collision with the main thread in malloc/free. Changing compiler settings to use multithreaded CRT libs solved it. Could it be the same problem?
DmitryKo
Engineer
Engineer
Posts: 85
Joined: 16 Feb 2006 15:30
Location: Moscow, Russia

Post by DmitryKo »

KUDr wrote:I had similar problems on my dual core amd (WinXP SP2). Autosave running in different thread caused sync collision with the main thread in malloc/free. Changing compiler settings to use multithreaded CRT libs solved it. Could it be the same problem?

I'd guess that's the most probable reason, considering that crashes most often happen at autosave and single-processor machines or multi-threaded runtime work fine...

But what do those NULL pointers mean - it looks like a stack corruption, is it supposed to be the result of sync problems? :? It's also suspicios that NPF functions seem to break at the same nodes...

And why malloc 24 bytes BTW - I'd guess memory pools are better at taking care of multiple small allocations...
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

KUDr wrote:I had similar problems on my dual core amd (WinXP SP2). Autosave running in different thread caused sync collision with the main thread in malloc/free. Changing compiler settings to use multithreaded CRT libs solved it. Could it be the same problem?
That is interesting...never would've thought about this.

I've made a multithreaded build, you can test this. It's on http://darkvater.openttd.org with the suffix '-multi'
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
DmitryKo
Engineer
Engineer
Posts: 85
Joined: 16 Feb 2006 15:30
Location: Moscow, Russia

Post by DmitryKo »

Darkvater wrote:I've made a multithreaded build, you can test this.

Gives this message on startup:

Code: Select all

Error! 
Tried to load non-existing sprite #585.
Probable cause: Wrong/Missing NewGRFs
:?: :?
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

Probably your install, it runs perfectly here.

Hmm, you need a different openttd.grf? Weird
Attachments
openttd.grf
(25.1 KiB) Downloaded 139 times
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

Oops, don't use my builds. They are from the 0.4.5 branch and not the tag. I don't think that matters much for these crashes though. If you could give feedback on this one crashing or not, it can be incorporated into the next release.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: Semrush [Bot] and 3 guests