beefeather / chromedevtools

Automatically exported from code.google.com/p/chromedevtools
Other
0 stars 0 forks source link

Getting RuntimeException failed to add Script again #64

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
SDK/Debugger version:
Chromium JavaScript Remote 
Debugger    0.3.4.201202250214  org.chromium.debug.feature.group
Eclipse version:
eclipse.buildId=M20110210-1200
java.version=1.6.0_29
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.java.product -keyring 
/Users/andy/.eclipse_keyring -showlocation
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product 
org.eclipse.epp.package.java.product -keyring /Users/andy/.eclipse_keyring 
-showlocation
Google Chrome/V8 Embedder + version: node.js 0.6.12 darwin
OS + version: darwin 10.7.3 x86_64

What steps will reproduce the problem?
1. Start app "node --debug app" (this is the devel branch of 
git://github.com/richtera/calipso.git you'd need mongodb and node.js to 
reproduce)
2. Attach with V8 remote debugger through eclipse
3.

What is the expected result?
They should all load.

What happens instead?
Almost all files load but there are a few that don't.
My suspicion is that in some cases either node.js or V8 is trying to 
"embellish" the filename by adding ": line" at the end which causes the 
debugger to "scream murder" and deny the addition of an invalidly named file. 
I'll check whether this is happening in node or v8...
java.lang.RuntimeException: Exception occured in callback
    at org.chromium.sdk.CallbackSemaphore.tryAcquire(CallbackSemaphore.java:68)
    at org.chromium.sdk.CallbackSemaphore.tryAcquireDefault(CallbackSemaphore.java:33)
    at org.chromium.sdk.internal.v8native.JavascriptVmImpl.getScripts(JavascriptVmImpl.java:40)
    at org.chromium.debug.core.model.VProjectWorkspaceBridge.reloadScriptsAtStart(VProjectWorkspaceBridge.java:127)
    at org.chromium.debug.core.model.LaunchInitializationProcedure.execute(LaunchInitializationProcedure.java:81)
    at org.chromium.debug.core.model.LaunchInitializationProcedure.access$0(LaunchInitializationProcedure.java:65)
    at org.chromium.debug.core.model.LaunchInitializationProcedure$2.run(LaunchInitializationProcedure.java:39)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.Exception: Exception saved from callback
    at org.chromium.sdk.CallbackSemaphore.callbackDone(CallbackSemaphore.java:80)
    at org.chromium.sdk.internal.v8native.V8CommandProcessor$2.run(V8CommandProcessor.java:96)
    at org.chromium.sdk.internal.transport.SocketConnection$4.report(SocketConnection.java:318)
    at org.chromium.sdk.internal.transport.SocketConnection$ResponseDispatcherThread.run(SocketConnection.java:209)
Caused by: java.lang.RuntimeException: Failed to add script 
</Users/andy/calipso/node_modules/winston/lib/winston/config.js : 467>
    at org.chromium.debug.core.model.ResourceManager.addScript(ResourceManager.java:92)
    at org.chromium.debug.core.model.VProjectWorkspaceBridge$3.success(VProjectWorkspaceBridge.java:137)
    at org.chromium.sdk.internal.v8native.DebugSession$ScriptManagerProxy$2.run(DebugSession.java:217)
    at org.chromium.sdk.internal.v8native.V8CommandProcessor$2.run(V8CommandProcessor.java:90)
    ... 2 more

Please provide any additional information below. If possible, attach a
(reduced) test-case.

Original issue reported on code.google.com by richt...@gmail.com on 11 Mar 2012 at 5:36

GoogleCodeExporter commented 8 years ago
The script id is 
"/Users/andy/calipso/node_modules/winston/lib/winston/config.js". I don't see 
how it could make a problem.

Unfortunately in line ResourceManager.java:92 cause exception is lost.
Correct source line should be
"throw new RuntimeException("Failed to add script " + id, e);"

Do you think you could recompile with this fix? Or simply see what happens in 
debugger?
(See http://code.google.com/p/chromedevtools/wiki/HowToDebug )

Or I could prepare a quick patch for you that does it. Which one should be 
better for you?

Original comment by peter.ry...@gmail.com on 12 Mar 2012 at 12:09

GoogleCodeExporter commented 8 years ago
I don't currently have my eclipse debugger setup to debug the plugins but if it 
would help I can do that. Currently I am spending time on the project which is 
causing this error but would like to help with the debug stubs as well. However 
how does the RuntimeException change fix the problem? I don't quite understand 
because winston/config.js is just a normal javascript file.

Original comment by richt...@gmail.com on 12 Mar 2012 at 1:00

GoogleCodeExporter commented 8 years ago
RuntimeException won't fix the problem, but we will know what the problem is. 
This in turn should help us fix it :)

Let me prepare a test patch for you.

Original comment by peter.ry...@gmail.com on 12 Mar 2012 at 1:15

GoogleCodeExporter commented 8 years ago
This is patch. You should try to run Eclipse from the command line with the 
additional parameter, like this:
<eclipse-dir>/Eclipse.app/Contents/MacOs/eclipse -dev <full_path_to_patch_jar>

This executable name is specific for Mac. Please not that jar must be specified 
by a full path, even if it's in the current directory.

The patch does nothing but adds a missing cause exception. I cannot guess what 
it could be. It can be easily an NPE for a one. Please reproduce the problem 
and send me a new stacktrace with the cause.

I hope the patch works.

Original comment by peter.ry...@gmail.com on 12 Mar 2012 at 1:23

Attachments:

GoogleCodeExporter commented 8 years ago
What's weird is that the 'scripts that can't be added' are in fact in
certain stack traces when you step through the code. There are several
files which error out this way but they did not have any similarities
to make this obvious.
The runtime error does have the file in question.
Andy

Original comment by richt...@gmail.com on 12 Mar 2012 at 1:25

GoogleCodeExporter commented 8 years ago
Cool, i will test tomorrow
Andy

Original comment by richt...@gmail.com on 12 Mar 2012 at 1:26

GoogleCodeExporter commented 8 years ago
Here is the underlying error:
org.eclipse.core.internal.resources.ResourceException: A resource exists with a 
different case: '/New_configuration/Config.js.chromium'.
There are different cased resources in my project. They should show up as 
"config.js" and "Config.js (1)" as they do for same cased resources. I 
downloaded the PDE and I am debugging the problem. I'll let you know.

Original comment by richt...@gmail.com on 12 Mar 2012 at 7:32

GoogleCodeExporter commented 8 years ago
The problem seems to be that the Container (i.e. 
org.eclipse.core.internal.resources.Container).getFile function will return a 
file to be nonexistent if the case is different yet prevent adding another file 
with different case. In my mind this is an eclipse problem. The only thing I 
could image is to catch the error and treat it by appending some string to make 
the filename unique. A quick fix would be to do the following:

    UniqueKeyGenerator.Factory<IFile> factory =
        new UniqueKeyGenerator.Factory<IFile>() {
      public IFile tryCreate(String uniqueName) {
        String filePathname = uniqueName + CHROMIUM_EXTENSION_SUFFIX;
        IFile file = handler.getFile(container, filePathname);
        if (file.exists()) {
          return null;
        }
        try {
          file.create(new ByteArrayInputStream("".getBytes()), false, null); //$NON-NLS-1$
        } catch (CoreException e) {
          if (e.getMessage().contains("different case"))
              return null;
          throw new RuntimeException(e);
        }
        return file;
      }
    };

This seems to work with my preliminary testing.
Andy

Original comment by richt...@gmail.com on 12 Mar 2012 at 7:55

GoogleCodeExporter commented 8 years ago
Here is the plugin with the fix.

Original comment by richt...@gmail.com on 12 Mar 2012 at 8:40

Attachments:

GoogleCodeExporter commented 8 years ago
Andy, thank you very much for reporting and investigating this bug. The fix 
should be ready soon. I guess you don't need a patch, since your fix should be 
fine. Let me know if you still need a patch though.

Original comment by peter.ry...@gmail.com on 13 Mar 2012 at 12:24

GoogleCodeExporter commented 8 years ago
Fixed in HEAD

Original comment by peter.ry...@gmail.com on 14 Mar 2012 at 5:56

GoogleCodeExporter commented 8 years ago
Fixed in 0.3.6

Original comment by peter.ry...@gmail.com on 2 Jul 2012 at 6:21