webtorrent / webtorrent-hybrid

WebTorrent (with WebRTC support in Node.js)
https://webtorrent.io
MIT License
519 stars 98 forks source link

Error at the end of execution #43

Closed sunilrx closed 5 years ago

sunilrx commented 8 years ago

When i run the command $ webtorrent-hybrid tirrentfilename, i get an error at the end

UNEXPECTED ERROR: If this is a bug in WebTorrent, report it! OPEN AN ISSUE: https://github.com/feross/webtorrent/issues

DEBUG INFO: webtorrent-cli 1.5.0, webtorrent 0.96.3, node v4.5.0, linux x64, exit 1 events.js:141 throw er; // Unhandled 'error' event ^

Error: write EPIPE at exports._errnoException (util.js:907:11) at WriteWrap.afterWrite (net.js:785:14)

feross commented 8 years ago

What is the full CLI command that you're using?

sunilrx commented 8 years ago

$ webtorrent-hybrid node_modules/webtorrent-hybrid/sintel.torrent --keep-seeding

feross commented 8 years ago

I can confirm this issue on Ubuntu 14.04.5 LTS x64.

@mappum This appears to be another electron-eval bug. (I confirmed I'm using the latest version of it.) It happens at the end of torrenting when peer connections are closed.

Here's a command you can use to reproduce on Ubuntu:

webtorrent-hybrid https://webtorrent.io/torrents/sintel.torrent --keep-seeding

Here is the full stack trace that I get:

{ Error: Error evaluating "
        var pc = conns["m"]
        var dc = pc.dataChannels[65535]

        if (dc.readyState === 'open') {
          var data = "AAAABQQAAAKq"
          data = base64ToArrayBuffer(data)
          dc.send(data)
        }
        dc.bufferedAmount
      " in "window": Failed to execute 'send' on 'RTCDataChannel': Could not send data
    at Daemon.<anonymous> (/usr/lib/node_modules/webtorrent-hybrid/node_modules/electron-eval/lib/index.js:81:21)
    at Daemon.g (events.js:286:16)
    at emitOne (events.js:96:13)
    at Daemon.emit (events.js:188:7)
    at ChildProcess.<anonymous> (/usr/lib/node_modules/webtorrent-hybrid/node_modules/electron-eval/lib/index.js:177:27)
    at emitOne (events.js:96:13)
    at ChildProcess.emit (events.js:188:7)
    at DestroyableTransform.<anonymous> (/usr/lib/node_modules/webtorrent-hybrid/node_modules/electron-eval/lib/index.js:210:29)
    at emitOne (events.js:96:13)
    at DestroyableTransform.emit (events.js:188:7)
  original: 'Failed to execute \'send\' on \'RTCDataChannel\': Could not send data' } RTCDataChannel {
  domain: null,
  _events: { error: [Function] },
  _eventsCount: 1,
  _maxListeners: undefined,
  _pcId: 'm',
  label: 'ea4ee18b698daab6b5216ca2e2d3a67cc9798b74',
  ordered: null,
  protocol: '',
  stream: 65535,
  id: 65535,
  readyState: 'open',
  bufferedAmount: 0,
  _bufferedAmountLowThreshold: 0,
  _binaryType: 'arraybuffer',
  maxPacketLifeType: null,
  maxRetransmits: null,
  negotiated: false,
  reliable: true,
  onmessage: [Function],
  onopen: [Function],
  onclose: [Function] }
FLYBYME commented 7 years ago

Im getting the same error but posted in the wrong issue.. https://github.com/feross/webtorrent-hybrid/issues/29#issuecomment-251567346

DiegoRBaquero commented 7 years ago

@FLYBYME This actually has the same error output as #29 and we didn't have full stack trace in the previous issue. Meaning this could be the same error and a commit brought the issue again.

FLYBYME commented 7 years ago

@DiegoRBaquero What version do you that works?

FLYBYME commented 7 years ago

I just installed v1.0.2 and its not kicking out the error.

feross commented 7 years ago

@FLYBYME Do you mean that the issue is fixed? Or, are you saying that you can't get a detailed error log anymore?

FLYBYME commented 7 years ago

@feross With version 1.0.2 running this command webtorrent-hybrid https://webtorrent.io/torrents/sintel.torrent --keep-seeding I do not get the error anymore.

BUT when I run this code I still get the error..

var WebTorrent = require('webtorrent-hybrid');
var keystone = require('keystone');
var jobs = keystone.jobs;
var client = new WebTorrent({
    port : 23543,
    dht : false
});

client.on('error', function(err) {
    // fatal server error!
    console.log(err.message);
});
function create(job, done) {
    console.log(job)
    var folder = job.data.folder || './torrents/files';
    var torrent = client.add(job.data.torrent, {
        path : folder
    }, function(torrent) {

    });
    torrent.on('infoHash', function() {
        console.log('infoHash');
    });

    torrent.on('metadata', function() {
        console.log('metadata');
    });

    torrent.on('ready', function() {
        console.log('ready');
    });
    torrent.on('warning', function(err) {
        console.log('warning', err);
    });
    torrent.on('error', function(err) {
        console.log('error', err);
        done(err);
    });
    torrent.on('done', function() {
        console.log('done');
        done();
    });
    torrent.on('download', function(bytes) {
        //console.log((torrent.progress * 100).toFixed(2) + '%');
        if (job.progress)
            job.progress((torrent.progress * 100).toFixed(2), 100);
    });
}

jobs.process('torrent download', 10, create);

keystone.list('Torrent').model.find({
    state : 'published'
}).exec(function(err, results) {
    results.forEach(function(torrent) {
        create({
            data : {
                torrent : torrent.torrent.path + '/' + torrent.torrent.filename,
                folder : torrent.folder
            }
        }, function() {
            //
        });
    });
});
ghost commented 7 years ago

Having similar problems using both Windows and Linux. On Windows it crashes and gives off an error as soon as you start seeding a file. On Linux it crashes and gives off an error if a peer disconnects from your torrent.

//Windows error log on CMD using Nodejs:

Z:>webtorrent-hybrid seed BVSC-CANDELA.mp4 Downloading: BVSC-CANDELA.mp4 Info hash: 18e18810fadb772d2903acb473cbe91717362637 Speed: 0 B/s Downloaded: 31 MB/31 MB Uploaded: 0 B Running time: 10s Time remaining: a few seconds Peers: 0/0

UNEXPECTED ERROR: If this is a bug in WebTorrent, report it! OPEN AN ISSUE: https://github.com/feross/webtorrent/issues

DEBUG INFO: webtorrent-cli 1.6.0, webtorrent 0.97.2, node v6.9.1, win32 ia32, ex it 1 events.js:160 throw er; // Unhandled 'error' event ^ Error: write EPIPE at exports._errnoException (util.js:1026:11) at ChildProcess.target._send (internal/child_process.js:654:20) at ChildProcess.target.send (internal/child_process.js:538:19) at Daemon._eval (C:\Users\Denise\AppData\Roaming\npm\node_modules\webtorrent -hybrid\node_modules\electron-eval\lib\index.js:91:18) at C:\Users\Denise\AppData\Roaming\npm\node_modules\webtorrent-hybrid\node_m odules\electron-eval\lib\index.js:190:32 at Array.forEach (native) at ChildProcess. (C:\Users\Denise\AppData\Roaming\npm\node_module s\webtorrent-hybrid\node_modules\electron-eval\lib\index.js:189:24) at ChildProcess.g (events.js:291:16) at emitTwo (events.js:106:13) at ChildProcess.emit (events.js:191:7)

Z:>

mccbala commented 6 years ago

Got this error message while I tried to exit using Ctrl+C on Ubuntu 18.04. Anything to do with the script not being able to exit gracefully?

Command: webtorrent-hybrid <torrent-file-url> --keep-seeding

^C
webtorrent is exiting...

UNEXPECTED ERROR: If this is a bug in WebTorrent, report it!
OPEN AN ISSUE: https://github.com/webtorrent/webtorrent-cli/issues

DEBUG INFO: webtorrent-cli 1.12.3, webtorrent 0.102.1, node v8.11.4, linux x64, exit 1
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at _errnoException (util.js:992:11)
    at Pipe.onread (net.js:618:25)
feross commented 5 years ago

This issue appears stale since it has been open for a while with no activity. I'm going to close it for now. If this is still issue, please feel free to leave a comment or open a new issue.