Getting timeout #qv6

I’m having the issue too at bittorrent/stages/qv6

My code works just fine when using cargo run download sample.torrent -o /tmp/test.txt.
But using the same parts of code to download pieces from a magnet link, I get the timeout issue when running the codecrafters test (or submit) commands.

My Rust code is available at GitHub - shide1989/shide1989-codecrafters-bittorrent-rust: Build your own BitTorrent challenge ! (in Rust)

@shide1989 I moved your post to a standalone topic, since it seems to be a separate issue.

I’ll look at your code shortly. In the meantime, could you try adding logs for the download progress to see how far it gets before timing out?

1 Like

Sure, here’s the logs :

codecrafters-bittorrent-rust on  master [!] ➜ codecrafters submit
Submitting changes (commit: 6248bf8)...

⚡ This is a turbo test run. https://codecrafters.io/turbo

Running tests. Logs should appear shortly...

[compile]    Compiling bittorrent-starter-rust v0.1.0 (/app)
[compile]     Finished release [optimized] target(s) in 19.05s
[compile] Compilation successful.

[tester::#QV6] Running tests for Stage #QV6 (Magnet Links - Download a piece)
[tester::#QV6] Running ./your_bittorrent.sh magnet_download_piece -o /tmp/torrents1394643788/piece-0 "magnet:?xt=urn:btih:3f994a835e090238873498636b98a3e78d1c34ca&dn=magnet2.gif&tr=http%3A%2F%2Fbittorrent-test-tracker.codecrafters.io%2Fannounce" 0
[your_program] Tracker URL: http://bittorrent-test-tracker.codecrafters.io/announce
[your_program] Name: Some("magnet2.gif")
[your_program] Peer ID: 2d524e302e302e302d4f371471616c6c5bb2078d
[your_program] Peer extensions: [16]
[your_program] Peer Metadata Extension ID: 1
[your_program] Peer Metadata Size: 91
[your_program] MessageID [1]
[your_program] Received payload "d8:msg_typei1e5:piecei0e10:total_sizei91eed6:lengthi79752e4:name11:magnet2.gif12:piece lengthi262144e6:pieces20:×\u{8a}\u{7f}UÝØ\u{9f}ïG{Ä\u{9d}\u{93}\u{8b}ÇäÙ@\u{94}ñe"
[your_program] Received message ID 1
[your_program] Length: 79752
[your_program] Info Hash: 3f994a835e090238873498636b98a3e78d1c34ca
[your_program] Piece Length: 262144
[your_program] d78a7f55ddd89fef477bc49d938bc7e4d94094f1
[your_program]   - Downloading piece: piece_index: 0, piece_len: 262144
[your_program]     - Downloading block: piece_index: 0, begin: 0, length: 16384
[your_program]     - Downloading block: piece_index: 0, begin: 49152, length: 16384
[your_program]     - Downloading block: piece_index: 0, begin: 65536, length: 16384
[your_program]     - Downloading block: piece_index: 0, begin: 16384, length: 16384
[your_program]     - Downloading block: piece_index: 0, begin: 32768, length: 16384
[tester::#QV6] timed out, test exceeded 10 seconds
[tester::#QV6] Test failed (try setting 'debug: true' in your codecrafters.yml to see more details)

View our article on debugging test failures: https://codecrafters.io/debug

I also tried to limit the simultaneous tcpStream writes sent to 5, to see if I was getting some kind of blocked, but it didn’t change anything

1 Like

@shide1989 I tried running your code, but it hangs both with codecrafters test and when run locally.

Could you try running this command locally to see if it hangs or works for you as well?

./your_bittorrent.sh magnet_download_piece -o /tmp/torrents1485664656/piece-1 "magnet:?xt=urn:btih:ad42ce8109f54c99613ce38f9b4d87e70f24a165&dn=magnet1.gif&tr=http%3A%2F%2Fbittorrent-test-tracker.codecrafters.io%2Fannounce" 1

Yeah it hangs, its been like this for this stage

Somewhere in the process I was missing a “send interest” message, due to the new code for the magnet link.

After adding it, it worked just fine.

Thanks for your help !

(now I just have to get a free Membership week to be able to submit it lol)

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.