Code Monkey home page Code Monkey logo

Comments (11)

Cacodaimon avatar Cacodaimon commented on August 18, 2024

@YayConnolly

I can't reproduce the bug on my Linux system so we have to do some dead reckoning here, there are two possibilities why the WebSocket server crashes. The first and likely cause is that the chrome sends some empty TCP packets to the server the second and unlikely one would be another application trying to connect to the newly opened TCP Socket.

Therefore I start with the most obvious one.

I crated a new branch for testing, can you install the ST package manually by following those instructions and checkout the following branch.

from ghosttext.

YayC avatar YayC commented on August 18, 2024

Thanks for looking into this.

Using the test branch you set up (origin/MacOSXEmptyWebSocketHeaderTest), sublime freezes with this message in the console (screenshot because frozen):

2014-12-02_1644

Using the master branch, sublime still doesn't crash and I'm getting the original error:

WebSocketServer id: 1
Setting on message handler
Setting on close handler
Start
Listening on: 60728
Exception in thread Thread-51:
Traceback (most recent call last):
  File "/Users/JConnolly/Library/Application Support/Sublime Text 3/Packages/GhostText-for-SublimeText/WebSocket/WebSocketServer.py", line 61, in start
    self._frame.parse(header)
  File "/Users/JConnolly/Library/Application Support/Sublime Text 3/Packages/GhostText-for-SublimeText/WebSocket/Frame.py", line 52, in parse
    self._parse_first_byte(data[0])
IndexError: index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./threading.py", line 901, in _bootstrap_inner
  File "/Users/JConnolly/Library/Application Support/Sublime Text 3/Packages/GhostText-for-SublimeText/GhostText.py", line 33, in run
    self._server.start()
  File "/Users/JConnolly/Library/Application Support/Sublime Text 3/Packages/GhostText-for-SublimeText/WebSocket/WebSocketServer.py", line 63, in start
    print(str(e))
UnboundLocalError: local variable 'e' referenced before assignment

from ghosttext.

Cacodaimon avatar Cacodaimon commented on August 18, 2024

Really strange... I have added some verbose debug output, can you pull my changes and try it again?

from ghosttext.

Cacodaimon avatar Cacodaimon commented on August 18, 2024

@bfred-it
Can you reproduce the error on your system?

from ghosttext.

YayC avatar YayC commented on August 18, 2024

Sorry for the delay. Not getting to any log statements, sublime crashes and takes up all the cpu in activity monitor:

2014-12-04_1631

I also got this strange output on a previous try:

2014-12-04_1630

from ghosttext.

fregante avatar fregante commented on August 18, 2024

It works fine here on GitHub.
Chrome 40
ST3 b3065
OS X 10.9.5

WebSocketServer id: 1
Setting on message handler
Setting on close handler
Start
Listening on: 58282
b'474554202f20485454502f312e310d0a486f73743a206c6f63616c686f73743a35383238320d0a436f6e6e656374696f6e3a20557067726164650d0a507261676d613a206e6f2d63616368650d0a43616368652d436f6e74726f6c3a206e6f2d63616368650d0a557067726164653a20776562736f636b65740d0a4f726967696e3a206368726f6d652d657874656e73696f6e3a2f2f6465646f6c646b6b6b646f6d6e6766676667676a686f70696369646e6e6b666b0d0a5365632d576562536f636b65742d56657273696f6e3a2031330d0a557365722d4167656e743a204d6f7a696c6c612f352e3020284d6163696e746f73683b20496e74656c204d6163204f5320582031305f395f3529204170706c655765624b69742f3533372e333620284b48544d4c2c206c696b65204765636b6f29204368726f6d652f34302e302e323231342e3238205361666172692f3533372e33360d0a4163636570742d456e636f64696e673a20677a69702c206465666c6174652c20736463680d0a4163636570742d4c616e67756167653a20656e2d55532c656e3b713d302e382c69743b713d302e360d0a436f6f6b69653a205048505345535349443d66383239303362653436313863323837663166323038306434656130643962353b20735f63633d747275653b20735f73713d253542253542422535442535443b2053514c6974654d616e616765725f63757272656e744c616e6775653d323b206b657973746f6e652e7369643d732533416e6136657933317a6f587879304438666847415f555774462e5369364663562532465a4333386876707133334973756f35686b6d764a5136253246335844334e53574d61775a4e6b3b20585352462d544f4b454e3d397970366d4764384a743850514d586d6d7363314a4b4551457a4955777556626e53675a6f2533440d0a5365632d576562536f636b65742d4b65793a20416636775550336849395a596d75344e31724b4865513d3d0d0a5365632d576562536f636b65742d457874656e73696f6e733a207065726d6573736167652d6465666c6174653b20636c69656e745f6d61785f77696e646f775f626974730d0a0d0a'
b'GET / HTTP/1.1\r\nHost: localhost:58282\r\nConnection: Upgrade\r\nPragma: no-cache\r\nCache-Control: no-cache\r\nUpgrade: websocket\r\nOrigin: chrome-extension://dedoldkkkdomngfgfggjhopicidnnkfk\r\nSec-WebSocket-Version: 13\r\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.28 Safari/537.36\r\nAccept-Encoding: gzip, deflate, sdch\r\nAccept-Language: en-US,en;q=0.8,it;q=0.6\r\nCookie: PHPSESSID=f82903be4618c287f1f2080d4ea0d9b5; s_cc=true; s_sq=%5B%5BB%5D%5D; SQLiteManager_currentLangue=2; keystone.sid=s%3Ana6ey31zoXxy0D8fhGA_UWtF.Si6FcV%2FZC38hvpq33Isuo5hkmvJQ6%2F3XD3NSWMawZNk; XSRF-TOKEN=9yp6mGd8Jt8PQMXmmsc1JKEQEzIUwuVbnSgZo%3D\r\nSec-WebSocket-Key: Af6wUP3hI9ZYmu4N1rKHeQ==\r\nSec-WebSocket-Extensions: permessage-deflate; client_max_window_bits\r\n\r\n'
b'81fe00ca454f9f983e6debfd3d3bbda2676db3ba362af3fd'
b'81fe00ca454f9f983e6debfd3d3bbda2676db3ba362af3fd263bf6f72b3cbda21e34bdeb312eedec6775afb4672af1fc6775afe51863bdec2c3bf3fd6775bdde2426f3eb652ef9ec203dbfeb3226ebfb2d26f1ff653bf0b8163afdf42c22fab8112ae7ec6567d0cb1d6faea86b76b1ac696fcced2723f6f5206fcbfd3d3bbfab6c6f5d2f6506eceb302abfbb717dbf5af26fdcf92620fbf92c22f0f66a08f7f7363bcbfd3d3bb2fe2a3db2db2d3df0f5206db3ba303df3ba7f6df8f13127eafa6b2cf0f56763bdeb3c21ebf93d6da5ba6732'
bytearray(b'\x81\xfe\x00\xcaEO\x9f\x98>m\xeb\xfd=;\xbd\xa2gm\xb3\xba6*\xf3\xfd&;\xf6\xf7+<\xbd\xa2\x1e4\xbd\xeb1.\xed\xecgu\xaf\xb4g*\xf1\xfcgu\xaf\xe5\x18c\xbd\xec,;\xf3\xfdgu\xbd\xde$&\xf3\xebe.\xf9\xec =\xbf\xeb2&\xeb\xfb-&\xf1\xffe;\xf0\xb8\x16:\xfd\xf4,"\xfa\xb8\x11*\xe7\xeceg\xd0\xcb\x1do\xae\xa8kv\xb1\xacio\xcc\xed\'#\xf6\xf5 o\xcb\xfd=;\xbf\xablo]/e\x06\xec\xeb0*\xbf\xbbq}\xbfZ\xf2o\xdc\xf9& \xfb\xf9,"\xf0\xf6j\x08\xf7\xf76;\xcb\xfd=;\xb2\xfe*=\xb2\xdb-=\xf0\xf5 m\xb3\xba0=\xf3\xba\x7fm\xf8\xf11\'\xea\xfak,\xf0\xf5gc\xbd\xeb<!\xeb\xf9=m\xa5\xbag2')
Bind view with id: 107
Setting on message handler
b'888047cd929b'
Stop
Triggering on_close
Unbind view with id: 107

from ghosttext.

Cacodaimon avatar Cacodaimon commented on August 18, 2024

@bfred-it
Thanks, I really should buy myself a used Mac…

I also got this strange output on a previous try:

It's not strange it the raw initial request send by the browser, do you receive a second line of debug output? This line should start with: b'GET / HTTP/1.1\r\nHost (This is the same request as UTF8 encoded string) like in Federico output example.

from ghosttext.

fregante avatar fregante commented on August 18, 2024

You might be able to virtualize OS X instead of buying a whole computer :D

from ghosttext.

Cacodaimon avatar Cacodaimon commented on August 18, 2024

@YayConnolly
Can you start a new test it could be solved now.

@bfred-it
Good idea, I give it a try when I find the time.

from ghosttext.

YayC avatar YayC commented on August 18, 2024

Just pulled the latest from the "MacOSXEmptyWebSocketHeaderTest" branch, and it works! Thanks @Cacodaimon :).

ps what an awesome plugin, didn't realize it updated in realtime.

from ghosttext.

Cacodaimon avatar Cacodaimon commented on August 18, 2024

I'm glad that the fix works, I gonna merge the changes into the master branch soon the update will be available via Package Control.

from ghosttext.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.