[posila][0.17.79]Crash when applying a CreateEntityTriggerEffectItem

This subforum contains all the issues which we already resolved.
Post Reply
yangbowen1028
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Apr 09, 2019 7:08 am
Contact:

[posila][0.17.79]Crash when applying a CreateEntityTriggerEffectItem

Post by yangbowen1028 »

I was trying to add a CreateEntityTriggerEffect that creates a dummy entity, with trigger_created_entity set to true, so that the Lua control script can capture the on_trigger_created_entity event and do complex logic. I created an entity prototype with type "particle" for the dummy entity. However as soon as I fired the weapon, the game crashed.

Mods enabled : stdlib 1.3.0, and the temp20191120 mod that I was making.

Recreation: Just install the attached mods, load the save file "save20191125" and fire the first weapon.

Expected: The dummy entity should be created and the event should be fired, which should be captured by the control script.

Reality: The game crashed with a popup dialog.
Attachments
factorio-current.log
The log file.
(10.24 KiB) Downloaded 39 times
save20191125.zip
The save file.
(1.25 MiB) Downloaded 44 times
temp20191120_0.0.0.zip
The mod that caused the crash.
(991.79 KiB) Downloaded 49 times
stdlib_1.3.0.zip
(364.76 KiB) Downloaded 41 times
Last edited by yangbowen1028 on Mon Nov 25, 2019 2:01 am, edited 1 time in total.

yangbowen1028
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Apr 09, 2019 7:08 am
Contact:

Re: [0.17.79]Crash when applying a CreateEntityTriggerEffectItem

Post by yangbowen1028 »

As FFF#322 mentioned the particle system will be separated from the entity system, perhaps the crash was related to the new particle system?
However I didn't find a more suitable entity type for the dummy entity. IMHO, ideally the game should offer a heavyweight entity version besides the lightweight particle version for particles, so that mods can use the "particle entity" for dummies with script-controlled behaviour.

User avatar
TruePikachu
Filter Inserter
Filter Inserter
Posts: 978
Joined: Sat Apr 09, 2016 8:39 pm
Contact:

Re: [0.17.79]Crash when applying a CreateEntityTriggerEffectItem

Post by TruePikachu »

The changes described in the FFF are slated to be added for 0.18.0; they are not present in 0.17.

EDIT:

Code: Select all

 123.843 Error CrashHandler.cpp:462: Exception Code: c0000005, Address: 0x00007ff70a9fcf2b
ModuleBase: 0x00007ff70a1a0000, ImageSize: 0184b000, RelativeAddress: 0085cf2b
 123.843 Error CrashHandler.cpp:468: Access Violation: Read at address 0000000000000000
 123.843 Error CrashHandler.cpp:482: Exception Context:
rax=0000000000000000, rbx=0000000000000000, rcx=aa8b87658afe0000,
rdx=000000af8882e420, rsi=000000af8882e888, rdi=000002acee9d2cb0,
rip=00007ff70a9fcf2b, rsp=000000af8882e3a0, rbp=000000af8882e4a0,
 r8=00000766000022e8,  r9=7fffffff7fffffff, r10=0000000000000000,
r11=000000af8882e320, r12=000002acee9d2cc0, r13=000002acee9958c0,
r14=000000af8882e750, r15=000002acd2920080
 123.843 Crashed in D:\Factorio\temp20191120\bin\x64\factorio.exe (0x00007ff70a1a0000 - 0x00007ff70b9eb000)
Factorio crashed. Generating symbolized stacktrace, please wait ...
c:\cygwin64\tmp\factorio-build-shnskz\libraries\stackwalker\stackwalker.cpp (924): StackWalker::ShowCallstack
c:\cygwin64\tmp\factorio-build-shnskz\src\util\logger.cpp (537): Logger::writeStacktrace
c:\cygwin64\tmp\factorio-build-shnskz\src\util\logger.cpp (544): Logger::logStacktrace
c:\cygwin64\tmp\factorio-build-shnskz\src\util\crashhandler.cpp (184): CrashHandler::writeStackTrace
c:\cygwin64\tmp\factorio-build-shnskz\src\util\crashhandler.cpp (511): CrashHandler::SehHandler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF991B4B057)
00007FF991B4B057 (KERNELBASE): (filename not available): UnhandledExceptionFilter
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF99423720E)
00007FF99423720E (ntdll): (filename not available): memset
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF99421EB26)
00007FF99421EB26 (ntdll): (filename not available): _C_specific_handler
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF99423357F)
00007FF99423357F (ntdll): (filename not available): _chkstk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF9941E3F31)
00007FF9941E3F31 (ntdll): (filename not available): RtlRaiseException
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF99423211E)
00007FF99423211E (ntdll): (filename not available): KiUserExceptionDispatcher
c:\cygwin64\tmp\factorio-build-shnskz\src\trigger\createentitytriggereffectitem.cpp (35): CreateEntityTriggerEffectItem::applyInternal
c:\cygwin64\tmp\factorio-build-shnskz\src\trigger\triggereffect.cpp (32): TriggerEffect::apply
c:\cygwin64\tmp\factorio-build-shnskz\src\trigger\directtriggeritem.cpp (27): DirectTriggerItem::apply
c:\cygwin64\tmp\factorio-build-shnskz\src\trigger\trigger.cpp (21): Trigger::apply
c:\cygwin64\tmp\factorio-build-shnskz\src\trigger\shooter.cpp (647): Shooter::doShoot
c:\cygwin64\tmp\factorio-build-shnskz\src\trigger\shooter.cpp (472): Shooter::shootInternal
c:\cygwin64\tmp\factorio-build-shnskz\src\trigger\shooter.cpp (129): Shooter::shoot
c:\cygwin64\tmp\factorio-build-shnskz\src\entity\car.cpp (750): Car::shoot
c:\cygwin64\tmp\factorio-build-shnskz\src\entity\car.cpp (271): Car::update
c:\cygwin64\tmp\factorio-build-shnskz\src\surface\chunk.cpp (647): Chunk::updateActiveEntities
c:\cygwin64\tmp\factorio-build-shnskz\src\surface\chunk.cpp (704): Chunk::updateEntities
c:\cygwin64\tmp\factorio-build-shnskz\src\surface\surface.cpp (1495): Surface::update
c:\cygwin64\tmp\factorio-build-shnskz\src\map\map.cpp (1565): Map::updateEntities
c:\cygwin64\tmp\factorio-build-shnskz\src\game.cpp (201): Game::update
c:\cygwin64\tmp\factorio-build-shnskz\src\scenario\scenario.cpp (1216): Scenario::update
c:\cygwin64\tmp\factorio-build-shnskz\src\mainloop.cpp (1163): MainLoop::gameUpdateStep
c:\cygwin64\tmp\factorio-build-shnskz\src\mainloop.cpp (1032): MainLoop::gameUpdateLoop
c:\cygwin64\tmp\factorio-build-shnskz\src\util\workerthread.cpp (42): WorkerThread::loop
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.15.26726\include\thr\xthread (230): std::_LaunchPad<std::unique_ptr<std::tuple<void (__cdecl*)(ParallelDesyncReportCreator *),ParallelDesyncReportCreator *>,std::default_delete<std::tuple<void (__cdecl*)(ParallelDesyncReportCreator *),ParallelDesyncReportCreator *> > > >::_Go
c:\program files (x86)\microsoft visual studio\2017\buildtools\vc\tools\msvc\14.15.26726\include\thr\xthread (209): std::_Pad::_Call_func
minkernel\crts\ucrt\src\appcrt\startup\thread.cpp (115): thread_start<unsigned int (__cdecl*)(void * __ptr64)>
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF993C56FD4)
00007FF993C56FD4 (KERNEL32): (filename not available): BaseThreadInitThunk
ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 00007FF9941FA6C1)
00007FF9941FA6C1 (ntdll): (filename not available): RtlUserThreadStart

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [0.17.79]Crash when applying a CreateEntityTriggerEffectItem

Post by posila »

It crashed because you need to use create-particle trigger effect to create particles. But the bug is that passed verification after prototype parsing.

simple-entity is good candidate for dummy entities. It's not updatable and has less state than a particle so in that sense, it's even better dummy entity.

posila
Factorio Staff
Factorio Staff
Posts: 5201
Joined: Thu Jun 11, 2015 1:35 pm
Contact:

Re: [posila][0.17.79]Crash when applying a CreateEntityTriggerEffectItem

Post by posila »

So CreateEntityTriggerEffectItem didn't check if entity defined to be created was not particle and since particles are not entities anymore in 0.18, the bug has been fixed as a sideeffect.

I checked the other types that have special trigger effect items (fire-flame, smoke-with-trigger, explosion and sticker), fire-flame and smoke-with-trigger don't mind being created by create-entity trigger effect, explosion and sticker could fail to be created under in some cases (but should succeed in most) ... so I am on a fence if we should forbid creating them through create-entity trigger or not

Post Reply

Return to “Resolved Problems and Bugs”