Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

utp not working in dat-desktop #238

Closed
max-mapper opened this issue Feb 16, 2017 · 6 comments
Closed

utp not working in dat-desktop #238

max-mapper opened this issue Feb 16, 2017 · 6 comments

Comments

@max-mapper
Copy link
Contributor

when testing with @joehand and @yoshuawuyts we found out that utp (for some reason we don't yet know) is not getting used at all in dat-desktop@master. looking into it now

@max-mapper
Copy link
Contributor Author

max-mapper commented Feb 16, 2017

OK getting super weird behavior with require('utp-native')

To reproduce:

  • clone dat desktop
  • run npm install
  • run npm start
  • in the desktop app, import 79cf7ecc9baf627642099542b3714bbef51810da9f541eabb761029969d0161b
  • it should show the dat in the list. now quit the app
  • change this line in 'node_modules/discovery-swarm':
this._utp = opts.utp === false || !utp ? null : utp().on('connection', onconnection)

to this:

this._utp = utp()
this._utp.on('connection', onconnection)
  • run npm start again. Then Dat Desktop should freeze and never loads the dat list

I first thought it was because utp-native was getting require()'d (but not initiatlized) three times (one from dat-doctor, one from dat-node in multidat, and third in dat-worker). But even when I disable dat-doctor and the require('dat-node') in multidat from running, the above issue still happens.

Also, @joehand sent me a working build from his laptop, but it failed for me. We logged out the value of this._utp in discovery swarm, and for his working build it was https://www.irccloud.com/pastebin/raw/ayX1UegS and same build of the app on my machine it was null

His machine (utp worked):

uname -a: Darwin Hand-Pro.local 14.5.0 Darwin Kernel Version 14.5.0: Sun Sep 25 22:07:15 PDT 2016; root:xnu-2782.50.9~1/RELEASE_X86_64 x86_64
gcc -v: Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

My machine:

~/src/js/dat-desktop 🐈  uname -a
Darwin maxwuzhere.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
~/src/js/dat-desktop 🐈  gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

@juliangruber
Copy link
Collaborator

juliangruber commented Feb 17, 2017

I think I found the issue. Apparently when you child_process.fork in electron, runtime in the forked process is node, not electron. Then you get this error requiring utp-native (inserting a console.log in discovery-swarms try/catch surrounding that require):

Error: No native build was found for runtime=node abi=50 platform=darwin arch=x64

Working on a fix now

@mafintosh
Copy link
Contributor

I released utp-native with bundled prebuilds for all platform (excluding windows) so this should be fixed by that if you reinstall. @juliangruber is the issue you describe gonna affect the other native modules also? If so I can do a release of sodium-encryption|signatures with sodium-native since that ships with bundled prebuilds as well

@juliangruber
Copy link
Collaborator

this seems to work for me now. please close when you ACK

@juliangruber
Copy link
Collaborator

(re install node_modules)

@max-mapper
Copy link
Contributor Author

woot

screen shot 2017-02-17 at 2 14 36 pm

@joehand joehand closed this as completed Feb 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants