-
|
The notes on upgrading to libtorrent 2.0 mention In Java land with our jlibtorrent (C++ to Java wrapper) we get random silent crashes but eventually managed to get verbosity up and found this: I looked for possible changes in the way these signals are handled and found Are there other signals remapped, like when handling UDP packets? (perhaps hinted by this specific crash log) Am I on the right track? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
|
I've added the recommended libjsig, the signal handling switches warnings no longer appear and now I can get proper crash logs caused by native calls to libtorrent on our UI thread, which are hopefully issues i need to fix in my application layer due to our wrongful use of the new 2.0 API. But just out of curiosity and to rule out nmap issues, I'll see if there's a other disk handler available closer to 1.2s and see if that's truly the culprit of the crash. |
Beta Was this translation helpful? Give feedback.
-
|
yes, libtorrent needs to handle certain signals during disk I/O operations. When using memory mapped files, disk writes are made by copying bytes into memory regions. There is no error code return path for memcopy, so the only way the kernel can signal errors (such as I believe the JVM also installs signal handlers for managing its garbage collection, so it sounds plausible that there's some clash. Perhaps libtorrent is failing to properly restore the previous signal handler? |
Beta Was this translation helpful? Give feedback.
-
|
So, other than disk IO done with mmap and having to hack the signal handlers to catch errors, is there any other mechanism in libtorrent 2.0 that's rewriting the signal handlers? It's running perfectly in windows, which I imagine uses the posix disk IO. I've tried creating session parameters using posix disk IO to see if the crashes go away, I can now create torrents, seed, and I have no crashes I can replicate that way, but just leaving the client running for a few minutes seeding can yield random crashes. When I turn off libjsig (to mitigate the issues of signal handling conflicts, say when doing garbage collection like you mentioned) I can see the crashes are still due to signal handling issues, here's the latest one I saw: I wonder if there's something you are doing with UDP that's similar:
|
Beta Was this translation helpful? Give feedback.
-
|
nvm, I believe it's something with set_piece_hashes that might be using the new mmap disk io, still getting crashes creating torrents without adding them to a session. |
Beta Was this translation helpful? Give feedback.
-
|
Looks like that might be it, leaving these comments for others that may have this issue in the future on macos My code was wrapping this version of which in turn calls the default disk_io_constructor Will confirm later if a |
Beta Was this translation helpful? Give feedback.
That was it.
I've added a new
set_piece_hashes_posix_disk_iofor jlibtorrent which finally made the crash go away.