multihack / multihack-brackets

Realtime collaboration for programmers. (Brackets Extension)
MIT License
24 stars 9 forks source link

New files not syncing #37

Closed siphomateke closed 7 years ago

siphomateke commented 7 years ago

Issue Creating a new file while connected to another computer through multihack-server does not create the file on the other computer.

Steps to reproduce

  1. Create a multihack-server
  2. Connect to the server from the computer that is hosting the server (computer 1)
  3. Connect to the server from another computer on the same LAN (computer 2)
  4. Create a new file within brackets on computer 1

Expected result A new file should be created on the computer 2

t-mullen commented 7 years ago

Hmmm, this should work.

Does the file appear on the other computer when you type something into it?

siphomateke commented 7 years ago

@RationalCoding No

siphomateke commented 7 years ago

@RationalCoding Is there a way of checking which files are set to sync on the server?

t-mullen commented 7 years ago

Thanks. It seems by this and your other issue that most of the syncing isn't working correctly for you...

Are you using Bracket's "new window" feature to test this, or a whole new instance of Brackets?

What is your OS and Brackets version?

And just to be sure, what is your Multihack-brackets and Multihack-server versions?

Thanks, hope I can get to the bottom of this for you :)

t-mullen commented 7 years ago

If you could post the Brackets console log, that would be immensely helpful as well.

t-mullen commented 7 years ago

And no, you can't tell what files are being synced from the server. The server actually has nothing to do with the syncing, that is all peer-to-peer!

siphomateke commented 7 years ago

@RationalCoding

  1. Yes the syncing has been very buggy for me.
  2. I am using a whole new instance of Brackets.
  3. OS: Windows 10 Home 1607, Brackets version: Release 1.8 build 1.8.0-17108
  4. Multihack-brackets version: 4.1.4, Multihack-server version: 4.0.0

Brackets console log:

Download the React DevTools for a better development experience: https://fb.me/react-devtools
/utils/DeprecationWarning.js:88 PreferencesManager.convertPreferences() has been deprecated. Please upgrade to the current Preferences system (https://github.com/adobe/brackets/wiki/Preferences-System#conversion-from-the-pre-36-preferences-system).
    at Object.convertPreferences (/preferences/PreferencesManager.js:323:28)
    at Object.eval (/utils/Resizer.js:557:24)
    at Object.context.execCb (file:///C:/Program%20Files%20(x86)
/utils/DeprecationWarning.js:88 Deprecated: Do not use $().on/off() on Brackets modules and model objects. Call on()/off() directly on the object without a $() wrapper.
    at new jQuery.fn.init (/brackets.js:465:36)
    at n (file:///C:/Program%20Files%20(x86)/Brackets/www/thirdparty/thirdparty.min.js:19:405)
    at attachHighlighter (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/bracket-match-highlighter/main.js:57:9)
    at Object.<anonymous> (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/bracket-match-highlighter/main.js:95:5)
    at Object.context.execCb (file:///C:/Program%20Files%20(x86)
/utils/DeprecationWarning.js:88 Use brackets.getModule("thirdparty/mustache/mustache") instead of global Mustache.
    at Object.defineProperty.get (/brackets.js:123:32)
    at Object.<anonymous> (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets/lib/ui.js:12:19)
    at Object.context.execCb (file:///C:/Program%20Files%20(x86)
/utils/DeprecationWarning.js:88 Use brackets.getModule("thirdparty/mustache/mustache") instead of global Mustache.
    at Object.defineProperty.get (/brackets.js:123:32)
    at Lang.get (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets/lib/lang/lang.js:19:12)
    at Object.<anonymous> (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets/lib/ui.js:13:25)
    at Object.context.execCb (file:///C:/Program%20Files%20(x86)
thirdparty.min.js:13 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
/command/KeyBindingManager.js:578 Fail to nomalize Cmd-Shift-]
/command/KeyBindingManager.js:578 Fail to nomalize Cmd-Shift-[
/LiveDevelopment/MultiBrowserImpl/transports/NodeSocketTransport.js:84 NodeSocketTransport - start
/utils/EventDispatcher.js:121 Possible memory leak: 16 'projectOpen' listeners attached to Objecton @ /utils/EventDispatcher.js:121
main.js:34 click
main.js:88 handleStart
/utils/DeprecationWarning.js:88 Deprecated: Do not use $().on/off() on Brackets modules and model objects. Call on()/off() directly on the object without a $() wrapper.
    at new jQuery.fn.init (/brackets.js:465:36)
    at n (file:///C:/Program%20Files%20(x86)/Brackets/www/thirdparty/thirdparty.min.js:19:405)
    at Object.CssColorPreview.regisiterHandlers (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/brackets-css-color-preview/main.js:141:13)
    at CssColorPreview.init (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/brackets-css-color-preview/main.js:136:29)
main.js:90 test Sipho
main.js:137 MH started
main.js:106 voice
main.js:115 yjs ready
filesystem.js:45 created .brackets.json
main.js:117 sending project
main.js:174 local create file
main.js:206 remote create file
2main.js:160 local selection
main.js:196 remote change undefined
editor.js:114 remote change
main.js:160 local selection
filesystem.js:47 sent 0 of 1
main.js:34 click
ui.js:99 Array[1]
/utils/DeprecationWarning.js:88 Use brackets.getModule("thirdparty/mustache/mustache") instead of global Mustache.
    at Object.defineProperty.get (/brackets.js:123:32)
    at UI.openModal (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets/lib/ui.js:106:7)
    at HTMLAnchorElement.<anonymous> (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets/main.js:36:10)
4main.js:201 remote seleciton
main.js:216 remote delete file
2main.js:160 local selection
main.js:206 remote create file
2main.js:160 local selection
main.js:201 remote seleciton
128main.js:160 local selection
http://192.168.8.100:6001/ Failed to load resource: the server responded with a status of 404 (Not Found)
24main.js:160 local selection
editor.js:184 indexFromPos
main.js:168 local change
main.js:169 test.js Object
main.js:160 local selection
editor.js:184 indexFromPos
main.js:168 local change
main.js:169 test.js Object
main.js:160 local selection
editor.js:184 indexFromPos
main.js:168 local change
main.js:169 test.js Object
main.js:160 local selection
editor.js:184 indexFromPos
main.js:168 local change
main.js:169 test.js Object
2main.js:160 local selection
editor.js:184 indexFromPos
main.js:168 local change
main.js:169 test.js Object
main.js:160 local selection
editor.js:184 indexFromPos
main.js:168 local change
main.js:169 test.js Object
main.js:160 local selection
editor.js:184 indexFromPos
main.js:168 local change
main.js:169 test.js Object
main.js:160 local selection
editor.js:184 indexFromPos
main.js:168 local change
main.js:169 test.js Object
main.js:160 local selection
editor.js:184 indexFromPos
main.js:168 local change
main.js:169 test.js Object
main.js:160 local selection
editor.js:184 indexFromPos
main.js:168 local change
main.js:169 test.js Object
main.js:160 local selection
editor.js:184 indexFromPos
main.js:168 local change
main.js:169 test.js Object
main.js:160 local selection
editor.js:184 indexFromPos
main.js:168 local change
main.js:169 test.js Object
2main.js:201 remote seleciton
119main.js:160 local selection
main.js:34 click
ui.js:99 Array[1]
https://api.github.com/repos/adobe/brackets/contributors?per_page=100&page=1&_=1496307109524 Failed to load resource: net::ERR_NAME_NOT_RESOLVED

If it helps I can also upload my full system information log

siphomateke commented 7 years ago

@RationalCoding Oh I thought the server managed all the code. So what does the server do? How is it different from just doing it without making a server?

t-mullen commented 7 years ago

I can't see anything wrong with your setup or logs immediately (it's nearly identical to my own setup), but I'll take a closer look later.

The server sets up the P2P connection, serves multihack-web, and provides a proxy for versions without P2P support. You don't really need to run your own instance unless you have strict security concerns, have firewall issues, or want to save me some server bandwidth :p

siphomateke commented 7 years ago

@RationalCoding OK. Thanks for replying so quickly. I love this extension when it is working but thus far it's been a bit unstable. If there is anything else I need to provide to help you debug it, just let me know.

t-mullen commented 7 years ago

Fixed in 4.2.0

t-mullen commented 7 years ago

Thanks again for all the bug reports. It's a shame these things made it past testing, but there were some major changes a few weeks ago. I'll try to be more careful in the future. :)

siphomateke commented 7 years ago

@RationalCoding Thanks for all the work. Unfortunately it still doesn't work. Now it won't sync at all for some reason. Whether it's on the same PC or multiple ones, it isn't syncing. At first, it was showing the other computer in the room. Then, after disconnecting and reconnecting there were duplicates of one of the computers. Now, I can't seem to get it to work at all. I will try to reproduce. I don't get why I am having so many issues. Could it be to do with me using windows 10?

t-mullen commented 7 years ago

Hmmm... I'm starting to think that might be the case. I'll get a VM up to try and reproduce.

I'm the meantime, could you switch to the public server (to rule out any server issues), and post your log next time syncing fails?

siphomateke commented 7 years ago

@RationalCoding It seems to work on one computer (multiple brackets instances) just fine on the public server. I had thought I had tried the public server by not hosting a multihack-server but I forgot to clear my custom hostname preference 😄. On two computers (on the public server), however, it is still behaving strangely. The steps I carried were as follows:

  1. Host on computer1 (roomID: "chromebot", nickname: "T")
  2. connect from computer2 (roomID: "chromebot", nickname: "S") with the file test.js which contains: "// Test content"

computer1 log:

main.js:36 click
main.js:97 handleStart
main.js:99 chromebot T
main.js:146 MH started
main.js:124 yjs ready
main.js:115 voice

new in computer1 log after computer2 connects

multihack-core.js:2971 Uncaught Error: Ice connection failed.Peer._onIceConnectionStateChange @ multihack-core.js:2971Peer.self._pc.oniceconnectionstatechange @ multihack-core.js:2953

computer2 log:

main.js:36 click
main.js:97 handleStart
main.js:99 chromebot S
main.js:146 MH started
main.js:124 yjs ready
filesystem.js:45 created test.js
main.js:126 sending project
main.js:183 local create file
main.js:215 remote create file
editor.js:132 create file  test.js 
main.js:169 local selection
main.js:169 local selection
main.js:205 remote change undefined
editor.js:116 remote change test.js Object {from: Pos, to: Pos, text: "// Test content"} undefined
main.js:169 local selection
filesystem.js:47 sent 0 of 1
main.js:115 voice
multihack-core.js:2971 Uncaught Error: Ice connection failed.

Both computers can see the other in the room but nothing is syncing.

One more thing, I updated brackets to "Release 1.9 build 1.9.0-17312" to see if that would help (it didn't).

t-mullen commented 7 years ago

Oh, the P2P connection failed. That should be just intermittent though. Can you confirm this happens repeatedly?

t-mullen commented 7 years ago

Paging @kifhan. Any ideas on why this might be happening, I know you took a look at this the other day.

Another reason to implement a fallback on P2P connections too.

siphomateke commented 7 years ago

@RationalCoding Yes. I tried it multiple times to see if it was reproducible. It might be to do with it being online. I will test it on a LAN tomorrow.

t-mullen commented 7 years ago

Ah, you weren't connected to the internet? Just your LAN?

siphomateke commented 7 years ago

I was connected to the internet but the other computer was on the same LAN. This time it is in another location connected to the internet.

t-mullen commented 7 years ago

@nextgensparx 4.2.1 has a fix I pushed to the web version that is supposed to reduce these types of errors. Can you give it a try and tell me if anything changes?

I can confirm it's not a Windows 10 issue btw.

siphomateke commented 7 years ago

@RationalCoding Still exactly the same.

computer1 log:

main.js:36 click
main.js:97 handleStart
main.js:99 chromebot T
main.js:146 MH started
main.js:124 yjs ready
main.js:115 voice
multihack-core.js:18091 Uncaught Error: Ice connection failed.Peer._onIceConnectionStateChange @ multihack-core.js:18091Peer.self._pc.oniceconnectionstatechange @ multihack-core.js:17739

computer2 log:

main.js:36 click
main.js:97 handleStart
main.js:99 chromebot S
main.js:146 MH started
main.js:124 yjs ready
filesystem.js:45 created test.js
main.js:126 sending project
main.js:183 local create file
main.js:215 remote create file
editor.js:132 create file  test.js 
main.js:169 local selection
main.js:169 local selection
main.js:205 remote change undefined
editor.js:116 remote change test.js Object {from: Pos, to: Pos, text: "// Test content"} undefined
main.js:169 local selection
filesystem.js:47 sent 0 of 1
main.js:115 voice
multihack-core.js:18091 Uncaught Error: Ice connection failed.

You said it fixes some stuff in the web version should I try that instead of the brackets version?

t-mullen commented 7 years ago

You could try the web version. That would help rule out some network issues.

https://rationalcoding.github.io/multihack-web/

siphomateke commented 7 years ago

It appears to behave exactly the same from the web version. I can see the other computer in the room but no files are syncing. In brackets on the same computer, I can connect to the web version just fine like having two instances of brackets running. It's also throwing the same error I believe: Uncaught Error: Ice connection failed. at Peer._onIceConnectionStateChange (multihack.js:28029) at RTCPeerConnection.Peer.self._pc.oniceconnectionstatechange (multihack.js:27677)

t-mullen commented 7 years ago

It's definitely a network issue then. Sometimes these ICE failures just "go away", so I encourage you to try again later. You could also try disabling any firewalls on your machine and router and see if that helps. Using a VPN may also work. These failures aren't related to Multihack, but WebRTC in general.

I'm working on switching to the fallback when this happens, but it'll take some time.

t-mullen commented 7 years ago

Closing in favour of #45. Feel free to continue discussion here.

siphomateke commented 7 years ago

@RationalCoding OK. If it's out of your control that's fine. Would this still happen if the computers were on the same LAN?

t-mullen commented 7 years ago

It's possible, yes.

ICE is very complex and can fail for a large number of network-related reasons.

siphomateke commented 7 years ago

@RationalCoding OK it appears to work on LAN. One thing that is still annoying is new files not syncing immediately. I have found it it is due to having to type something in the file. It wasn't like this before the fix. Before you fixed it, it would not sync at all. But now, it syncs after you type something in the file. Could you maybe make it automatically sync instead or add a refresh sync button?

Another issue is trying to delete the new file. When I press delete on computer1 it deletes on computer1 but not on computer2. The logs (after pressing delete) are shown below;

computer1 (delete orange.js)

main.js:198 local delete file
main.js:225 remote delete file
main.js:210 remote seleciton
main.js:210 remote seleciton
main.js:210 remote seleciton
main.js:210 remote seleciton

(btw you misspelled 'selection' as 'seleciton' 😄 )

computer2

remote delete file
editor.js:132 create file  orange.js 
main.js:169 local selection
main.js:169 local selection

This only happens sometimes. Other times, it deletes it successfully on both computers.

t-mullen commented 7 years ago

4.2.2 now pushes an empty change when you open a new file, so sync happens immediately. (Note you'll need to save first, the in-memory files named "Untitled" cannot be synced).

It should also fix your deletion issue. For some reason I was just wiping the file if it was open, but not anymore.

t-mullen commented 7 years ago

@nextgensparx Did 4.2.2 fix your issues mentioned in this thread?

siphomateke commented 7 years ago

@RationalCoding Sorry for not responding. Currently on holiday. I will try and test this when I get back.

siphomateke commented 6 years ago

@RationalCoding An eternity later 😄,

New files now sync, hooray!

The extension fails to load sometimes but that might be because a conflicting extension:

/utils/ExtensionLoader.js:227 [Extension] failed to load C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets - Error: only one instance of babel-polyfill is allowederrback @ /utils/ExtensionLoader.js:227
/utils/ExtensionLoader.js:231 Error: only one instance of babel-polyfill is allowed
    at Object.<anonymous> (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets/lib/npm/multihack-core.js:8:669)
    at Object.r.3.core-js/fn/regexp/escape (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets/lib/npm/multihack-core.js:8:1288)
    at s (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets/lib/npm/multihack-core.js:1:2862)
    at file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets/lib/npm/multihack-core.js:1:2913
    at Object.r.401.babel-polyfill (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets/lib/npm/multihack-core.js:5129:586)
    at s (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets/lib/npm/multihack-core.js:1:2862)
    at e (file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets/lib/npm/multihack-core.js:1:3037)
    at file:///C:/Users/sipho_000/AppData/Roaming/Brackets/extensions/user/multihack-brackets/lib/npm/multihack-core.js:1:3056
    at Object.context.execCb (file:///C:/Program%20Files%20(x86)/Brackets/www/thirdparty/requirejs/require.js:1658:33)
    at Object.Module.check (file:///C:/Program%20Files%20(x86)/Brackets/www/thirdparty/requirejs/require.js:869:55)

It also occasionally still duplicates the contents of files, but I can't reproduce it.

t-mullen commented 6 years ago

Great. I've fixed the babel-polyfill conflict in 4.3.1.