[TIMOB-23638] Android: Unable to debug an application with newer V8
GitHub Issue | n/a |
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2016-08-02T13:28:54.000+0000 |
Affected Version/s | Release 6.0.0 |
Fix Version/s | Release 6.0.0 |
Components | Android |
Labels | n/a |
Reporter | Ewan Harris |
Assignee | Christopher Williams |
Created | 2016-07-14T14:31:27.000+0000 |
Updated | 2018-08-06T17:49:18.000+0000 |
Description
Description
When debugging a project on Titanium SDK 6.0.0+ on Android, the debugger does not work at all.
Comments
JSON Source
https://github.com/appcelerator/titanium_mobile/pull/8136
For QE: V8 used to have a piece that would open a socket and handle connections to the debugger directly. With the update to V8, I needed to re-implement that piece since it had been removed. So really, the test here is simply to ensure you can debug applications on Titanium 6.0.0+ with Studio (ideally an alloy and classic project).
[~cwilliams] I just happened to try this again on master as well as the build for master 6.0.0.v20160728020336. Perhaps it could be my environment but debugging doesn't seem to be working again for me. I'm currently still checking this out. Trying to see if I can get it working.
Crap, yeah this was working with the PR, we both had it working, right? Anyways, I see that: 1. It doesn't work with run-on-main-thread on. 2. It crashes with it off:
The more I look at this issue, the more I am confused. So, I think there's a possible bug around the JNIEnv issue I noted, and I have a local fix for that. But I am getting crashes and odd behavior left and right here. I _think_ we may be running into a V8 GC race issue, similar to: https://github.com/nodejs/node/issues/7654 If I run a local Appc Studio dev intense through Eclipse under the debugger, I can avoid the crashes by breaking in Java code that firs events down to V8. So it appears there may be some GC race condition involved. I'm testing with run-on-main-thread turned to true. But I'm also almost never getting it to stop on an actual breakpoint. I see the commands to set the breakpoint, but it never seems to actually hit the breakpoint!
Spoke too soon. This plays a role with the recent changes to fix the actual names used for __filename and __dirname. Apparently the debugger code in Studio always hacks off the leading '/', and therefore the name Studio's debugger uses and the name used by V8 don't match. That's why the breakpoints never got "hit". So to sum up: - There's a bug with the handling of JNIEnv sometimes, I have a local fix. - I think there's a V8 GC race condition bug that was triggering constantly for me before, but now won't. - The changes to use proper absolute paths for __filename caused a mismatch between Studio and V8 in file naming. This will require a fix to Studio to retain the leading slash (or maybe toggle behavior based on SDK version?)
We may want to update the V8 patch rev to grab the latest fixes on 5.1.x branch. I see one related to debugging: https://github.com/v8/v8/commit/4bf0f334fdca37c55e28cff7281d6b548e7f98cf
Setting run-on-main-thread to false seems to have brought back the GC crashing/race issue for me. Ugh.
https://github.com/appcelerator/titanium_mobile/pull/8185
https://github.com/appcelerator/titanium_studio/pull/793
Both Titanium SDK and Studio PR are merged.
Cleaning up older fixed issues. If this issue should not have been closed as fixed, please reopen.