Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caught internal_error: HandshakeManager::receive_succeeded(...) Unread data won't fit PCB's read buffer. #256

Closed
slingamn opened this issue Nov 10, 2024 · 6 comments

Comments

@slingamn
Copy link
Contributor

Congratulations on the new release!

I tried applying the patchset from #134 to master (at the time of writing, eddcb1f). (Without the patchset, my rtorrent instance is basically unresponsive due to the high number of synchronous DNS lookups). rtorrent then crashes immediately with:

Caught internal_error: HandshakeManager::receive_succeeded(...) Unread data won't fit PCB's read buffer.
/home/shivaram/workspace/sandbox/lib/libtorrent.so.22(_ZN7torrent14internal_error10initializeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x74) [0x74b6be624484]
/home/shivaram/workspace/sandbox/bin/rtorrent(_ZN7torrent14internal_errorC1EPKc+0x88) [0x593e64ff8af8]
/home/shivaram/workspace/sandbox/lib/libtorrent.so.22(+0x460b4) [0x74b6be5eb0b4]
/home/shivaram/workspace/sandbox/lib/libtorrent.so.22(+0x45988) [0x74b6be5ea988]
/home/shivaram/workspace/sandbox/lib/libtorrent.so.22(_ZN7torrent9PollEPoll7performEv+0xe9) [0x74b6be62c5f9]
/home/shivaram/workspace/sandbox/lib/libtorrent.so.22(_ZN7torrent11thread_base10event_loopEPS0_+0x12a) [0x74b6be62014a]
/home/shivaram/workspace/sandbox/bin/rtorrent(+0x47c60) [0x593e64ff0c60]
/lib/x86_64-linux-gnu/libc.so.6(+0x2a1ca) [0x74b6bde2a1ca]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b) [0x74b6bde2a28b]
/home/shivaram/workspace/sandbox/bin/rtorrent(+0x485d5) [0x593e64ff15d5]

I bisected this to 11c38cc / #254. So the release tag v0.14.0 and the subsequent commit a83dcb9 don't have this problem. But it's not clear to me what in #254 would cause this.

Thanks for your time.

@rakshasa
Copy link
Owner

rakshasa commented Nov 13, 2024

There's logging instructions in #254, use those and send me the results.

Note that you need to also change DISABLED__USE_EXTRA_DEBUG to USE_EXTRA_DEBUG in the above commit.

@slingamn
Copy link
Contributor Author

I was able to reproduce the issue quickly against bbeeab8 and b30a169 without my patchset. So it seems like this is an unresolved issue in master.

I'm trying to get logs for it with ./configure --with-extra-debug but I'm having trouble actually finding the logs. Are they supposed to display in the log window displayed when the l key is pressed? If so I think rtorrent may be crashing before the logs can actually be displayed.

@rakshasa
Copy link
Owner

In src/protocol/handshake.cc change #if DISABLED__USE_EXTRA_DEBUG to #if USE_EXTRA_DEBUG.

log.open_file = "connection", /run/self/logs/connection.log
log.add_output = "connection", "connection"

@slingamn
Copy link
Contributor Author

slingamn commented Dec 1, 2024

0000000000 handshake_manager->11.22.33.44: created outgoing connection: fd:83 encryption:31 message:2
0000000000 handshake->11.22.33.44:65432: read_info
0000000000 handshake->11.22.33.44:65432: fill_read_buffer : size:68 remaining:0 reserved_left:1254
0000000000 handshake->11.22.33.44:65432: read_peer
0000000000 handshake->11.22.33.44:65432: fill_read_buffer : size:20 remaining:20 reserved_left:1186
0000000000 handshake->11.22.33.44:65432: event_read : READ_MESSAGE
0000000000 handshake->11.22.33.44:65432: fill_read_buffer : size:5 remaining:0 reserved_left:1186
0000000000 handshake->11.22.33.44:65432: read_port
0000000000 handshake->11.22.33.44:65432: fill_read_buffer : size:7 remaining:5 reserved_left:1181
0000000000 handshake->11.22.33.44:65432: event_read : READ_MESSAGE
0000000000 handshake->11.22.33.44:65432: fill_read_buffer : size:5 remaining:65534 reserved_left:1179
0000000000 handshake_manager->11.22.33.44: handshake success: type:leech id:-[REDACTED]

followed by

Caught internal_error: HandshakeManager::receive_succeeded(...) Unread data won't fit PCB's read buffer.

@slingamn
Copy link
Contributor Author

slingamn commented Dec 1, 2024

I think I diagnosed this (I'm still testing): #264

@jmakovicka
Copy link
Contributor

I think I diagnosed this (I'm still testing): #264

I had the same issue, fixed it exactly the same way.

@rakshasa rakshasa closed this as completed Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants