meganz / sdk

MEGA C++ SDK
BSD 2-Clause "Simplified" License
1.33k stars 504 forks source link

MegaCli crash #2584

Open tdparsenal opened 2 years ago

tdparsenal commented 2 years ago

Hi Authors, I am testing Mega SDK with python bindings. However it crashed with following error

$ python megacli.py Mega sample app. Type help or ? to list commands.

(Cmd) ?

Documented commands (type help ):

cd export help login ls mount passwd pwd rm
exit get import logout mkdir mv put quit whoami

(Cmd) login Usage: login email password (Cmd) login tdparsenal@gmail.com xxxxxxxxxxxx (Cmd) INFO 2021-08-01 15:46:01,821 Request start (LOGIN) INFO 2021-08-01 15:46:03,448 Request finished (LOGIN); Result: No error INFO 2021-08-01 15:46:03,448 Request start (FETCH_NODES) python: src/megaclient.cpp:5394: bool mega::MegaClient::CacheableStatusMap::addOrUpdate(int64_t, int64_t): Assertion `mClient->statusTable && "Updating status without status table"' failed. [1] 73854 abort (core dumped) python megacli.py

It also happened with C++ native : megafuse, I have no idea on how statusTable should be initialized. Can you please check ?

kenkit commented 2 years ago

Happened to me on C++ sdk when login in too

sergiohs84 commented 2 years ago

Thanks for the feedback.

@kenkit can you please check if there's a file named megaclient_statecache12_status_*.db? If not, is there one named megaclient_statecache12_*.db?? They should be created in the working-path for the executable.

The assert could be triggered due to the missing status, when the later already exists. If that's the case, please, try removing all those *.db files and doing a fresh login with user+password afterwards. It should fix the issue :)

Thanks

kenkit commented 2 years ago

I see, let me try

kenkit commented 2 years ago

@sergiohs84 There is no such file where the exe is run, I've even tried checking the opened file handles when the app is running and there is no db file being opened/created when the app is running. I've built the master branch. with sqlite and curl library.

kenkit commented 2 years ago

LOG

[][debug] Informing cURL of timeout reached for 2 at 244414 [net.cpp:740]
[][debug] Adding curl socket 2452 to 1 [net.cpp:2686]
[][debug] Removing socket 2452 [net.cpp:2673]
[][debug] CURLMSG_DONE with HTTP status: 200 from g.api.mega.co.nz - 66.203.125.15 [net.cpp:2246]
[][debug]
[][info] Request (LOGIN) finished [megaapi_impl.cpp:16260]
[2021-10-22 19:29:49.027854] [0x00001e08] [trace]   *****Finished Signing into mega!
[][info] Request (FETCH_NODES) starting [megaapi_impl.cpp:16229]
[][warn] *!authring not found in cache. Fetching... [megaclient.cpp:12856]
[][warn] *!authRSA not found in cache. Fetching... [megaclient.cpp:12856]
[][warn] *!authCu255 not found in cache. Fetching... [megaclient.cpp:12856]
[][debug] DNS cache hit for g.api.mega.co.nz (IPv4) 66.203.125.15 [net.cpp:1987]
[][debug] cs POST target URL: https://g.api.mega.co.nz/......[net.cpp:1430]
[][debug]
[][debug] Using the IP of the hostname: XXXXXX [net.cpp:1461]
[][debug] Informing cURL of timeout reached for 2 at 244418 [net.cpp:740]
[][debug] Adding curl socket 2452 to 1 [net.cpp:2686]
[][debug] Removing socket 2452 [net.cpp:2673]
[][debug] CURLMSG_DONE with HTTP status: 200 from g.api.mega.co.nz - 66.203.125.15 [net.cpp:2246]
[][debug]
[][info] File versioning is enabled [commands.cpp:4251]
Assertion failed: mClient->statusTable && "Updating status without status table", file D:\programming\bak\neon_service\mega\sdk\src\megaclient.cpp, line 5645
kenkit commented 2 years ago

Screenshot 2021-10-22 194411 Don't know if this will help, it's where the crash occurred

kenkit commented 2 years ago

Call stack

ucrtbased.dll!7c3207b0() (Unknown Source:0)
ucrtbased.dll![Frames below may be incorrect and/or missing, no symbols loaded for ucrtbased.dll] (Unknown Source:0)
ucrtbased.dll!7c320941() (Unknown Source:0)
ucrtbased.dll!7c331c6a() (Unknown Source:0)
ucrtbased.dll!7c336064() (Unknown Source:0)
ucrtbased.dll!7c33468d() (Unknown Source:0)
ucrtbased.dll!7c33660a() (Unknown Source:0)
MegaPlugin.dll!mega::MegaClient::CacheableStatusMap::addOrUpdate(mega::CacheableStatus::Type type, __int64 value) Line 5645 (d:\programming\bak\neon_service\mega\sdk\src\megaclient.cpp:5645)
MegaPlugin.dll!mega::MegaClient::setBusinessStatus(mega::BizStatus newBizStatus) Line 7181 (d:\programming\bak\neon_service\mega\sdk\src\megaclient.cpp:7181)
MegaPlugin.dll!mega::CommandGetUserData::procresult(mega::Command::Result r) Line 4468 (d:\programming\bak\neon_service\mega\sdk\src\commands.cpp:4468)
MegaPlugin.dll!mega::Request::processCmdJSON(mega::Command * cmd) Line 66 (d:\programming\bak\neon_service\mega\sdk\src\request.cpp:66)
MegaPlugin.dll!mega::Request::process(mega::MegaClient * client) Line 115 (d:\programming\bak\neon_service\mega\sdk\src\request.cpp:115)
MegaPlugin.dll!mega::RequestDispatcher::serverresponse(std::string && movestring, mega::MegaClient * client) Line 291 (d:\programming\bak\neon_service\mega\sdk\src\request.cpp:291)
MegaPlugin.dll!mega::MegaClient::exec() Line 1948 (d:\programming\bak\neon_service\mega\sdk\src\megaclient.cpp:1948)
MegaPlugin.dll!mega::MegaApiImpl::loop() Line 6522 (d:\programming\bak\neon_service\mega\sdk\src\megaapi_impl.cpp:6522)
MegaPlugin.dll!mega::MegaApiImpl::threadEntryPoint(void * param) Line 5274 (d:\programming\bak\neon_service\mega\sdk\src\megaapi_impl.cpp:5274)
MegaPlugin.dll!std::invoke<void * (__cdecl*)(void *),void *>(void *(*)(void *) && _Obj, void * && _Arg1) Line 1595 (c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\type_traits:1595)
MegaPlugin.dll!std::thread::_Invoke<std::tuple<void * (__cdecl*)(void *),void *>,0,1>(void * _RawVals) Line 55 (c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\thread:55)
ucrtbased.dll!7c337682() (Unknown Source:0)
kernel32.dll!76ebfa29() (Unknown Source:0)
sergiohs84 commented 2 years ago

@sergiohs84 There is no such file where the exe is run, I've even tried checking the opened file handles when the app is running and there is no db file being opened/created when the app is running. I've built the master branch. with sqlite and curl library.

That's very weird. The SDK automatically creates DB files for persistence. If they are not found in the path of the executable, please, try to locate them in you FS. They should be somewhere, and perhaps that path is being automatically purged? :thinking:

kenkit commented 2 years ago

Yes I've confirmed no db files are being opened.

kenkit commented 2 years ago

@sergiohs84 are they created when you initialize megaapi object or when you initiate login request ?

sergiohs84 commented 2 years ago

@sergiohs84 are they created when you initialize megaapi object or when you initiate login request ?

They are created when you start a new session -> login + fetchnodes :)

kenkit commented 2 years ago

@sergiohs84 are they created when you initialize megaapi object or when you initiate login request ?

They are created when you start a new session -> login + fetchnodes :)

Will investigate with a debugger and find what is going on when I'm free, maybe I missed some compile flags when building ?