Skip to content

Error during debug on iOS: WebSocket is not open: readyState 2 (CLOSING) #4291

Closed
@rosen-vladimirov

Description

@rosen-vladimirov

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.1.1-2019-01-11-12787
  • Cross-platform modules: Not applicable
  • Android Runtime: Not applicable
  • iOS Runtime: 5.1.0
  • Plugin(s): Not applicable

Describe the bug
During debug on iOS, in case you open Chrome DevTools and close them before they've rendered the sources (i.e. while the communication between iOS Runtime and Chrome DevTools is in progress), CLI crashes with error:

WebSocket is not open: readyState 2 (CLOSING)
    at WebSocket.send (C:\Work\nativescript-cli\node_modules\ws\lib\websocket.js:314:19)
    at PacketStream.packets.on (C:\Work\nativescript-cli\lib\device-sockets\ios\app-debug-socket-proxy-factory.js:132:31)
    at emitOne (events.js:116:13)
    at PacketStream.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at PacketStream.Readable.push (_stream_readable.js:208:10)
    at PacketStream.Transform.push (_stream_transform.js:147:32)
    at PacketStream._transform (C:\Work\nativescript-cli\lib\device-sockets\ios\packet-stream.js:30:22)
    at PacketStream.Transform._read (_stream_transform.js:186:10)
    at PacketStream.Transform._write (_stream_transform.js:174:12)
    at doWrite (_stream_writable.js:397:12)
    at writeOrBuffer (_stream_writable.js:383:5)
    at PacketStream.Writable.write (_stream_writable.js:290:11)
    at Socket.ondata (_stream_readable.js:639:20)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at TCP.onread (net.js:597:20)

To Reproduce

  1. On any project run: tns debug ios (better use device). It could be even easier to reproduce with tns debug ios --bundle
  2. When CLI prints the Chrome DevTools URL, open it.
  3. After several seconds, but BEFORE seeing any file in the Chrome DevTools, close the browser tab.

NOTE: Issue is not reproducible every time.

Expected behavior
CLI to allow you to attach again later.

Metadata

Metadata

Labels

bugno-changelogThe issue is present only in `next` versions and was not included in official version.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions