Skip to content

Error during debug on iOS: RangeError: Index out of range #4292

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.0 or 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 Device, sometimes an error is shown in CLI and the process exits:

RangeError: Index out of range
at checkOffset (buffer.js:977:11)
at Buffer.readInt32BE (buffer.js:1142:5)
at PacketStream._transform (C:\Work\nativescript-cli\lib\device-sockets\ios\packet-stream.js:12:39)
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)

The actual problem is that CLI parses some messages from iOS Runtime and tries to send them to device. However, in some cases the messages are received by CLI on chunks and in rare occasions it is unable to parse them.

To Reproduce

NOTE: Issue is hard to reproduce. We've reproduced it in Sidekick when trying to debug on iOS device.

  1. Start debug session on iOS device
  2. Execute some actions while device is locked.

Expected behavior
CLI should work correctly

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions