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

Torrents with zero-length files crash on `fs.read` #461

Closed
liyuhao opened this issue Oct 12, 2015 · 7 comments
Closed

Torrents with zero-length files crash on `fs.read` #461

liyuhao opened this issue Oct 12, 2015 · 7 comments
Labels
bug

Comments

@liyuhao
Copy link

@liyuhao liyuhao commented Oct 12, 2015

Use the webtorrent as command app, and here is the log

DEBUG INFO: webtorrent 0.62.2, node v4.1.2, linux x64, exit 1
fs.js:582
binding.read(fd, buffer, offset, length, position, req);
^

Error: Offset is out of bounds
at Error (native)
at Object.fs.read (fs.js:582:11)
at /usr/lib/node_modules/webtorrent/node_modules/random-access-file/index.js:77:6
at apply (/usr/lib/node_modules/webtorrent/node_modules/thunky/index.js:16:28)
at /usr/lib/node_modules/webtorrent/node_modules/thunky/index.js:20:25
at onfinish (/usr/lib/node_modules/webtorrent/node_modules/random-access-file/index.js:37:4)
at /usr/lib/node_modules/webtorrent/node_modules/random-access-file/index.js:43:49
at FSReqWrap.oncomplete (fs.js:82:15)

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Dec 11, 2015

@liyuhao Have you solved it?

@Danmer

This comment has been minimized.

Copy link

@Danmer Danmer commented Dec 23, 2015

Same problem:

DEBUG INFO: webtorrent 0.63.4, node v5.1.0, win32 x64, exit 1
fs.js:620
  binding.read(fd, buffer, offset, length, position, req);
          ^

Error: Offset is out of bounds
    at Error (native)
    at Object.fs.read (fs.js:620:11)
    at C:\Users\danmer\AppData\Roaming\npm\node_modules\webtorrent\node_modules\random-access-file\index.js:77:6
    at apply (C:\Users\danmer\AppData\Roaming\npm\node_modules\webtorrent\node_modules\thunky\index.js:16:28)
    at C:\Users\danmer\AppData\Roaming\npm\node_modules\webtorrent\node_modules\thunky\index.js:20:25
    at onfinish (C:\Users\danmer\AppData\Roaming\npm\node_modules\webtorrent\node_modules\random-access-file\index.js:37:4)
    at C:\Users\danmer\AppData\Roaming\npm\node_modules\webtorrent\node_modules\random-access-file\index.js:43:49
    at FSReqWrap.oncomplete (fs.js:82:15)
 "dn" is not an internal or external command, operable program or batch file.

"dn" is not an internal or external command, operable program or batch file. showed even after successful downloads sometimes

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Dec 27, 2015

This is an odd error. How large is the torrent you're trying to download?

@jleal52

This comment has been minimized.

Copy link

@jleal52 jleal52 commented Jan 3, 2016

I've detected torrent with zero length files, give this error.

Running just this code:

var torrentStream = require('torrent-stream');
var parseTorrent = require('parse-torrent');

var parsed = parseTorrent('magnet:?xt=urn:btih:');
var engine = torrentStream(parsed);
engine.on('ready',function(e) {
        console.log('ready');
});

The stack trace error is:

fs.js:582
  binding.read(fd, buffer, offset, length, position, req);
          ^

Error: Offset is out of bounds
    at Error (native)
    at Object.fs.read (fs.js:582:11)
    at /home/usuario/torrent-coder/node_modules/torrent-stream/node_modules/random-access-file/index.js:77:6
    at apply (/home/usuario/torrent-coder/node_modules/torrent-stream/node_modules/thunky/index.js:16:28)
    at /home/usuario/torrent-coder/node_modules/torrent-stream/node_modules/thunky/index.js:20:25
    at onfinish (/home/usuario/torrent-coder/node_modules/torrent-stream/node_modules/random-access-file/index.js:37:4)
    at /home/usuario/torrent-coder/node_modules/torrent-stream/node_modules/random-access-file/index.js:43:49
    at FSReqWrap.oncomplete (fs.js:82:15)
@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 3, 2016

Aha! I've figured it out. This is caused by a bug in fs.read in node.js. Issue opened: nodejs/node#4517

@feross feross changed the title Can not download some magnet Torrents with zero-length files crash on `fs.read` Jan 3, 2016
@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jan 3, 2016

This is fixed in random-access-file 0.3.2.

@lock

This comment has been minimized.

Copy link

@lock lock bot commented May 5, 2018

This thread has been automatically locked because it has not had recent activity. To discuss futher, please open a new issue.

@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.