Breakpoint event is not reported in Node.js 6.
- Version: 6.5.0
- Platform: Darwin machinename15.6.0 Darwin Kernel Version 15.6.0: [date-time]; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
- Subsystem: Debugging
Hello, we are the developers for ReactNative extension for Visual Studio Code. We need your insights on the following issue:
We listen to the node process debugging port like this (this is our debugger code):
var socket = new Net.Socket();
socket.connect("localhost", 5858);
socket.on('data', function (data) {
return writeToLogFile(data);
});
We also have a simple ReactNative application like this (this is the debuggee):
01 import React, { Component } from 'react';
02 import {
03 AppRegistry, StyleSheet, Text, View, TouchableHighlight
04 } from 'react-native';
05
06 class example1 extends Component {
07 constructor(props) {
08 super(props);
09 setTimeout(() => {
10 console.log("Hi there");
11 }, 20000);
12 }
13
14 click() {
15 console.log("Entered Event");
16 console.log("Clicked");
17 }
18
19 render() {
20 return (
21 <View style={styles.container}>
22 <Text style={styles.welcome}>
23 Welcome to React Native!
24 </Text>
25 <TouchableHighlight onPress={this.click}>
26 <View>
27 <Text>Button!</Text>
28 </View>
29 </TouchableHighlight>
30 </View>
31 );
32 }
33 }
34 AppRegistry.registerComponent('example1', () => example1
When he breakpoint is set to a setTimeout handler (line 10), we can receive an event like this:
{"seq":95,"type":"event","event":"break","body":{"invocationText":"[anonymous]()","sourceLine":1505,"sourceColumn":0,"sourceLineText":"console.log(\"Hi there\");","script":{"id":152,"name":"/Users/cha/develop/example1/.vscode/.react/index.ios.bundle","lineOffset":0,"columnOffset":0,"lineCount":79066},"breakpoints":[3]}}
but when the break point is set to the click event handler (line 16). We cannot receive a "break" message from the socket. There is no message received at all. But the node process has apparently run into the event handler, since we could see the "Entered Event" emitted to the stdout. At the same time we also noticed UI freeze in the react native app, which suggests that the node process execution has suspended. At this point, if we explicitly request a "suspend" event, we can then see that the debugging stopped right at line 16.
The same issue does not reproduce for Node 4.5, but constantly reproduces with Node 6.5.
We'd like to hear some suggestions on how to diagnose this issue further.
Do you see the same behavior with v6.4.x? It's possible that 723fa9637c92bc921cf4627551015d80808ff9c8 is responsible.
I tried 6.2.0, 6.4.0 and 6.5.0. They all behave the same.
4.5.0 is different.
Okay, thanks. Do you have minimal test case I can try? Please don't say "install VS Code". :-)
Unfortunately we've had some difficulty in making a nicely minimal case. We can skip the "install VS Code" step without much trouble, but it still involves setting up a react-native debugging environment and having a react-native app drive events. From node's perspective that's just some network communication though, so it shouldn't be anything inherent to react-native.
@bnoordhuis, it's been a long time but we finally managed to get a stable repro where Node is the only requirement. Here is the repo with detailed repro steps: https://github.com/vladimir-kotikov/react_debug_mock.
@bnoordhuis Should this remain open? I'm guessing it's likely that 6.x will reach EOL before anyone fixes this. Maybe I can put help wanted and/or mentor available on it?
It's been a while but I remember tracking this deep inside V8 and concluding it wouldn't be an easy fix. Happy to help anyone who wants to work on this but he or she should be prepared to invest considerable time.
I think we can reasonably say that nobody is going to fix this in the near future? With Node 6 entering maintenance in a few days, should we close this issue?
That about sums it up; I'll close it out. Thanks anyway for the good repro, @vladimir-kotikov.