webtorrent: NWjs/utp-native - "Error: A dynamic link library (DLL) initialization routine failed" when upgrading Webtorrent from 0.108 to 0.109
What version of this package are you using? 0.109.2
What operating system, Node.js, and npm version? Windows 10, Node 12.13.1, npm 6.12.1
What happened? Upgrading from 108.6 to 109.2 broke something. I believe this PR is to blame, because utp-native gives loads of errors: https://github.com/webtorrent/webtorrent/commit/692b3d113c0a08a17ee53bca7e16180a94b4fbfe#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R77
This is my snippet for reproducing the issue (but it breaks everytime I use webtorrent for anything, actually):
let magnet = '<insert a magnet link>'
const wtorrent = new (require('webtorrent'))()
let done
setTimeout(() => {
if (done) return
wtorrent.destroy()
}, 3500)
wtorrent.add(magnet, (t) => {
wtorrent.destroy()
done = true
console.log('magnet size is', t.length)
})
Here’s the line I suspect is causing this, when installing the new webtorrent with npm:

Here is the error message in console when trying to use webtorrent:

What did you expect to happen? I’m not sure what it “should do”, but not erroring, it should just “do magic” and return something to me, be it file size, informations and/or fileparts.
Are you willing to submit a pull request to fix this bug? I doubt it, I have no idea how most of webtorrent works, it just works 😄
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (6 by maintainers)
@hicom150 FYI it seems to work for me, using your PR branch. It simply displays
webtorrent.utpasfalse, and everything seems to be working flawlessly as it used to pre-0.109.x, so thank you 😃As for suggestions:
That could be considered non-essential code, but there might be a case to be made about:
returning a warning and/or an error because I used an incompatible option. I personnaly wouldnt care for it, but if I were to be some developer somewhere trying to use utp:true and the created webtorrent instance always defaulted to utp:false, I’d be pretty upset not knowing why it isnt working.