orbitdb-archive / orbit

A distributed, serverless, peer-to-peer chat application on IPFS
MIT License
1.64k stars 116 forks source link

What exactly is "Loading" ? #216

Closed whyrusleeping closed 7 years ago

whyrusleeping commented 7 years ago

After i type in my username, i get the gray loading screen for a while. (as i write this it has been loading for quite some time). What exactly is happening here? Is it waiting for ipfs peerings?

Would be nice to maybe have a little bit of motion on the screen to make me think its not frozen, or maybe some sort of 'verbose' mode that gives on-screen indication of what its working on

whyrusleeping commented 7 years ago

As a followup to this, the loading never seemed to complete, so i killed the make start command i had run and received the following output:

➜  orbit git:(master) make start
npm start

> orbit@3.2.0 start /home/whyrusleeping/code/orbit
> npm run electron

> orbit@3.2.0 electron /home/whyrusleeping/code/orbit
> LOG=debug IPFS_FD_MAX=4096 $(npm bin)/electron .

2016-12-17T19:30:16.967Z [DEBUG] orbit-electron: Run index.js in 'debug' mode
2016-12-17T19:30:18.239Z [DEBUG] orbit-electron: Received 'disconnected' event from renderer process
2016-12-17T19:30:19.892Z [DEBUG] orbit-electron: Received 'ipfs-daemon-start' event from renderer process
2016-12-17T19:30:19.897Z [DEBUG] ipfs-daemon: Initializing IPFS daemon
2016-12-17T19:30:19.897Z [DEBUG] ipfs-daemon: Using IPFS repo at '/home/whyrusleeping/.config/orbit/why/ipfs'
2016-12-17T19:30:21.088Z [DEBUG] ipfs-daemon: Starting IPFS daemon
^Cmake: *** [Makefile:16: start] Interrupt
➜  orbit git:(master) 2016-12-17T19:42:21.089Z [DEBUG] orbit-electron: Closing...
2016-12-17T19:42:21.092Z [DEBUG] ipfs-daemon: Shutting down...
2016-12-17T19:42:21.092Z [DEBUG] ipfs-daemon: IPFS daemon finished
/home/whyrusleeping/code/orbit/node_modules/ipfs-daemon/src/ipfs-native-daemon.js:124
          this._peerId = id.id
                           ^

TypeError: Cannot read property 'id' of undefined
    at ipfs.id (/home/whyrusleeping/code/orbit/node_modules/ipfs-daemon/src/ipfs-native-daemon.js:124:28)
    at send (/home/whyrusleeping/code/orbit/node_modules/@haad/ipfs-api/src/api/id.js:16:16)
    at f (/home/whyrusleeping/code/orbit/node_modules/@haad/ipfs-api/node_modules/once/once.js:25:25)
    at ClientRequest.req.on (/home/whyrusleeping/code/orbit/node_modules/@haad/ipfs-api/src/request-api.js:122:5)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at Socket.socketErrorListener (_http_client.js:308:9)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1272:8)

I had just pulled latest master and run make before posting this issue

theobat commented 7 years ago

As written in the logs, Loading is starting an ipfs daemon, relevant code is here: https://github.com/haadcode/orbit/blob/master/index.js#L127. It's not peering to get the connected interface as far as I know.

I have seen long ipfs daemon startup as well, perhaps we should try to improve this a priority. Or try to get a more precise profiling on each sequence... https://github.com/haadcode/ipfs-daemon

haadcode commented 7 years ago

Thank you @whyrusleeping for reporting this. Your report lead me to a bug that I've fixed. Can you pull and run make clean && make. Btw. is running make clean in make a standard thing? Should it run?

The loading view was changed as we refactored the startup sequence. I added a proper loading screen, with motion AND verbose (debug log) output. Hope this helps you.

If it still errors, at least you should be able to now see the error clearly on your screen. If so, please do copy paste the error here.

haadcode commented 7 years ago

There's now movement during the loading that should tell you if it's frozen or not. If you run orbit-electron in dev mode, you will also get the go-ipfs stdout: screen shot 2017-02-06 at 17 38 59

The issue here should be fixed now. However, heads up @whyrusleeping, I've been seeing that weird behaviour on Linux that you reported some time ago where on the first run it doesn't start (no error, no hang) but quitting and starting the Electron app again, it'll work. Need to look into it.

Closing this issue as fixed.