Open proninyaroslav opened 1 year ago
I will look into this problem, but this file is auto-generated, so we need to find another solution.
I forgot that SWIG is used in the project, probably it's possible to describe the interface for code generation?
@aldenml 👋 Is there any good news about solving this problem?
Hi @proninyaroslav still nothing, but I will look at it.
Any updates? I've been stuck on this for so long waiting for a fix
@aldenml Hi! Any news?
Hi @proninyaroslav , hi :)
I looked a it and got close, but concluded it could take me a non-trivial amount of time to wrap up. Still no ETA.
@aldenml Thank you for still not giving up on this problem.
@aldenml
Initially, I thought that SIGSEGV
when calling dict_find_list_ex
only if the dictonary key is not in bdecode (for example announce-list
). But it turns out that SIGSEGV
is raised even if dict_find_list_ex
returns the correct bdecode object. For example, calling bdecode_node::list_size
on this object will also rais SIGSEGV
. It's very strange.
Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 7860 (Thread-13), pid 7751 (retorrent.debug)
Cmdline: org.proninyaroslav.libretorrent.debug
pid: 7751, tid: 7860, name: Thread-13 >>> org.proninyaroslav.libretorrent.debug <<<
#00 pc 00000000004e258b /data/app/~~NdgzqlpvdA_zPFCehZ-u9g==/org.proninyaroslav.libretorrent.debug-HZGrGgexkXsntScbKeq63Q==/base.apk!libtorrent4j.so (offset 0x479000) (BuildId: e8a7f9bbcc438c53202e53588fca979891cf4897)
#01 pc 00000000004657ff /data/app/~~NdgzqlpvdA_zPFCehZ-u9g==/org.proninyaroslav.libretorrent.debug-HZGrGgexkXsntScbKeq63Q==/base.apk!libtorrent4j.so (offset 0x479000) (Java_org_libtorrent4j_swig_libtorrent_1jni_bdecode_1node_1list_1size+15) (BuildId: e8a7f9bbcc438c53202e53588fca979891cf4897)
#14 pc 0000000000014968 /data/data/org.proninyaroslav.libretorrent.debug/code_cache/.overlay/base.apk/classes12.dex (org.proninyaroslav.libretorrent.core.model.session.TorrentSessionImpl.extractTrackers+0)
#20 pc 0000000000017af0 /data/data/org.proninyaroslav.libretorrent.debug/code_cache/.overlay/base.apk/classes12.dex (org.proninyaroslav.libretorrent.core.model.session.TorrentSessionImpl.mergeTorrent+0)
#26 pc 0000000000015758 /data/data/org.proninyaroslav.libretorrent.debug/code_cache/.overlay/base.apk/classes12.dex (org.proninyaroslav.libretorrent.core.model.session.TorrentSessionImpl.addTorrent+0)
#32 pc 000000000000bd48 <anonymous:7f28de7d4000> (org.proninyaroslav.libretorrent.core.model.TorrentEngine.addTorrentSync+0)
#38 pc 00000000000175e4 <anonymous:7f28de70f000> (org.proninyaroslav.libretorrent.ui.addtorrent.AddTorrentViewModel.lambda$addTorrent$5+0)
#44 pc 0000000000017170 <anonymous:7f28de70f000> (org.proninyaroslav.libretorrent.ui.addtorrent.AddTorrentViewModel.$r8$lambda$Ac_VEfLFHW8ule9GokjvWKj6DVg+0)
#50 pc 0000000000015770 <anonymous:7f28de70f000> (org.proninyaroslav.libretorrent.ui.addtorrent.AddTorrentViewModel$$ExternalSyntheticLambda5.run+0)
var announceNode = node.dict_find_list_ex("announce-list");
if (announceNode == null) {
return new ArrayList<>();
}
// SIGSEGV
var urls = new ArrayList<AnnounceEntry>(announceNode.list_size());
...
Hi @proninyaroslav, I'm sorry I have unable to find some time to dedicate to this issue. I deduced a time ago that this is not a trivial issue, and I think it's related to a flaw on how SWIG generate the code for this particular structure. This is still on my TODO list.
@aldenml Is there a workaround? Early I used trackers() method, but it was removed from libtorren.
When I try to call a method like
bdecode_node::dict_find_list_ex
and if the node is not found, then the method returns abdecode_node
object with a null pointer inside. So, if I call any method that works with a pointer (e.g.bdecode_node::list_size
) then it throws SIGSEGV:The solution is to check the pointer and return null
bdecode_node
if the pointer is null, for methodsdict_find_*_ex
,list_at
,dict_at_node
.