Opened 5 years ago

Closed 2 years ago

#11244 closed defect (fixed)

CLOUD: Crash when loading a save from the launcher

Reported by: bgK Owned by: sev-
Priority: high Component: Cloud
Version: Keywords:
Cc: Game:

Description

ScummVM 4810a5d8d35c5caa79f9a3a1e93d882de32b2d87.

When loading a save from the launcher, if cloud saves sync is still in progress, the following crash occurs:

Thread 6 received signal SIGSEGV, Segmentation fault

#0  0x004c7e80 in Common::SharedPtr<Graphics::Surface>::decRef (this=0x801ed0c) at ../common/ptr.h:203
#1  Common::SharedPtr<Graphics::Surface>::~SharedPtr (this=0x801ed0c, __in_chrg=<optimized out>) at ../common/ptr.h:124
#2  SaveStateDescriptor::~SaveStateDescriptor (this=0x801ec80, __in_chrg=<optimized out>) at ../engines/savestate.h:45
#3  Common::Array<SaveStateDescriptor>::freeStorage (this=<optimized out>, elements=<optimized out>, storage=0x801ec80) at ../common/array.h:319
#4  Common::Array<SaveStateDescriptor>::operator= (array=None of size 1, capacity 134678855 = {...}, this=0x866e764) at ../common/array.h:205
#5  Common::Array<SaveStateDescriptor>::operator= (array=None of size 1, capacity 134678855 = {...}, this=0x866e764) at ../common/array.h:201
#6  GUI::SaveLoadChooserDialog::listSaves (this=0x866e6e0) at ../gui/saveload-dialog.cpp:301
#7  0x004c725c in GUI::SaveLoadChooserDialog::updateSaveList (this=this@entry=0x866e6e0) at ../gui/saveload-dialog.cpp:296
#8  0x004c87b0 in GUI::SaveLoadChooserSimple::updateSaveList (this=0x866e6e0) at ../gui/saveload-dialog.cpp:661
#9  0x004cb688 in GUI::SaveLoadChooserSimple::handleCommand (this=0x866e6e0, sender=sender@entry=0x866f7cc, cmd=cmd@entry=1397966158, data=<optimized out>) at ../gui/saveload-dialog.cpp:470
#10 0x0050e0dc in GUI::CommandSender::sendCommand (data=0, cmd=1397966158, this=0x866f7cc) at ../gui/object.h:55
#11 Cloud::SavesSyncRequest::downloadNextFile (this=this@entry=0x866f7b8) at ../backends/cloud/savessyncrequest.cpp:269
#12 0x0050ffb4 in Cloud::SavesSyncRequest::directoryListedCallback (this=<optimized out>, response=...) at ../backends/cloud/savessyncrequest.cpp:162
#13 0x005180e0 in Cloud::Dropbox::DropboxListDirectoryRequest::responseCallback (this=<optimized out>, response=...) at ../backends/cloud/dropbox/dropboxlistdirectoryrequest.cpp:195
#14 0x00529580 in Networking::CurlJsonRequest::handle (this=0x866e068) at ../backends/networking/curl/curljsonrequest.cpp:77
#15 0x00526ccc in Networking::ConnectionManager::interateRequests (this=this@entry=0x816edb8) at ../backends/networking/curl/connectionmanager.cpp:184
#16 0x00526ed4 in Networking::ConnectionManager::handle (this=0x816edb8) at ../backends/networking/curl/connectionmanager.cpp:159
#17 0x00506ea4 in DefaultTimerManager::handler (this=this@entry=0x802d568) at ../backends/timer/default/default-timer.cpp:106
#18 0x0010a3e0 in _3DS::timerThreadFunc (arg=0x801e008) at ../backends/platform/3ds/osystem-events.cpp:288
#19 0x00621a90 in _thread_begin (arg=<optimized out>) at /home/fincs/pacman-packages/libctru/src/ctrulib-1.6.0/libctru/source/thread.c:37

Meanwhile, the main thread is starting the engine normally:

#0  svcSendSyncRequest () at /home/fincs/pacman-packages/libctru/src/ctrulib-1.6.0/libctru/source/svc.s:336
#1  0x006271c0 in FSUSER_OpenFile (out=0x8006328, out@entry=0x8006320, archive=<optimized out>, path=..., openFlags=openFlags@entry=1, attributes=attributes@entry=0) at /home/fincs/pacman-packages/libctru/src/ctrulib-1.6.0/libctru/source/services/fs.c:31
#2  0x0062b928 in sdmc_open (r=0x98d018 <impure_data>, fileStruct=0x869addc, path=<optimized out>, flags=65536, mode=438) at /home/fincs/pacman-packages/libctru/src/ctrulib-1.6.0/libctru/source/sdmc_dev.c:385
#3  0x007a3628 in _open_r ()
#4  0x007873c0 in _fopen_r ()
#5  0x0053218c in StdioStream::makeFromPath (path=..., writeMode=<optimized out>) at ../common/str.h:208
#6  0x00531408 in POSIXFilesystemNode::createReadStream (this=<optimized out>) at ../backends/fs/posix/posix-fs.h:60
#7  0x00600800 in Common::FSNode::createReadStream (this=0x8006d00) at ../common/ptr.h:152
#8  0x00600000 in Common::File::open (node=..., this=0x8006468) at ../common/file.cpp:73
--Type <RET> for more, q to quit, c to continue without paging--
#9  Common::File::open (this=this@entry=0x8006468, node=...) at ../common/file.cpp:62
#10 0x0053a2f4 in AdvancedMetaEngine::getFileProperties (this=this@entry=0x802a608, parent=..., allFiles=..., game=..., fname="a_data_french.mhk", fileProps=...) at ../common/hashmap.h:586
#11 0x0053a47c in AdvancedMetaEngine::detectGame (this=this@entry=0x802a608, parent=..., allFiles=..., language=language@entry=Common::EN_ANY, platform=platform@entry=Common::kPlatformWindows, extra="") at ../engines/advancedDetector.cpp:408
#12 0x005395b8 in AdvancedMetaEngine::createInstance (this=this@entry=0x802a608, syst=syst@entry=0x801e008, engine=0x8007b60, engine@entry=0x8007b58) at ../engines/advancedDetector.cpp:258
#13 0x0010d474 in runGame (Python Exception <class 'UnicodeDecodeError'> 'utf-8' codec can't decode byte 0xf8 in position 0: invalid start byte: 
edebuglevels=, system=..., plugin=0x802ed80) at ../base/main.cpp:193
#14 scummvm_main (argc=argc@entry=1, argv=argv@entry=0x8000000) at ../base/main.cpp:577
#15 0x00105d00 in main (argc=1, argv=0x8000000) at ../backends/platform/3ds/main.cpp:52

The save / load dialog is long gone when the network thread tries to access it.

Perhaps the save / load dialog should simply poll updates from the "cloud manager" rather than being updated by another thread.

Change History (3)

comment:1 by sev-, 4 years ago

Priority: normalhigh

comment:2 by Tkachov, 3 years ago

The dialog tries to avoid that by setting cloud sync CommandSender's target to nullptr both at destructor and close() method (saveload-dialog.cpp:70 and :183). It seems that was not enough.

I agree that simple polling could work fine here. (Not sure I'm the one who'd write it tho.)

I've also noticed that the same CommandSender/CommandReceiver scheme is used for the "download folder" case. It's possible that the same error can happen there too (gui/downloaddialog.cpp).

comment:3 by sev-, 2 years ago

Owner: set to sev-
Resolution: fixed
Status: newclosed

Fixed

Note: See TracTickets for help on using tickets.