-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to move the cache, Unable to create cache #113
Comments
Sometimes the browser emits stuff like this due to bugs and there’s no way to know that it can be safely filtered out. If it’s not appearing in the chrome console then either it’s filtering it out by itself (which would be odd) or there’s something slightly different in how Sublime is launching the browser, eg., the working directory or permissions or a concurrent browser session, or ??. You could try just deleting C:\Users\dkimble\AppData\Local\Google\Chrome\User Data\ShaderCache |
I had a little trouble deleting the ShaderCache and I discovered that it is because Chrome leaves a half a dozen processes running even after I close it. Once I disabled all of the extensions inside Chrome the error messages went away. However, now instead of opening the html file that I am trying to debug, I get a directory listing inside of C:\Program Files (x86)\Application\50.0.2661.102\ Any ideas why it would be looking for the html file here? If SWI was passing the proper port, it should redirect to my XAMPP directory root. Even after I turn the Apache server off and clear the cache in the browser, Chrome still opens up C:\Program files file when I run SWI I noticed that when I start the debugger there is no port listed. Can I edit this somewhere? I have included a screenshot of the sublime interface when I start the debugger. |
You can change the port with the chrome_remote_port setting. In your user settings JSON, add I seem to remember some bug of this sort in the past, and it might have been related to quoting in the command line we use to start Chrome. After this point, you'd have to debug. Incidentally you can edit this line to start logging the websocket traffic -- but your problem sounds upstream of that: websocket.enableTrace(False) |
By using a tool like sysinternals.com Process Explorer, you can perhaps right click on the chrome.exe process and see the original command line that launched it. That might give a clue. If you look at the function SwiDebugStartChromeCommand you can see what it's supposed to be doing. |
There are two settings files, one is the package settings (which has lots of defaults as you see) and the other is the user settings (which is empty by default). These are both at Preferences>Package Setttings>Web Inspector>Settings - Default || Settings - User. You'll want to edit the latter to add your port, or override the chrome_path, or whatever else you need to do. Does that help? |
I think the next step is to debug. Unfortunately it looks like I didn't document in the wiki here how to do that. From memory,
If I remember correctly, you should now be able to attach from VS -- be sure to choose the Python debugging engine in the Attach dialog. |
I followed the suggested steps and now I have a new repo cloned inside the packages folder. I created a new Python project in VS, opened the swi.py file and set the port to a static value just as an experiment. The first time I tried an integer but ST3 would not open SWI so I assigned the port variable to a string value of "8082" which is the port my local Apache server is listening on. At this point SWI will open the Chrome browser but still using the programs directory at file:///C:/Program%20Files%20(x86)/Google/Chrome/Application/51.0.2704.84/ |
@GhostInTheMachines apologies for missing your post. Somehow I got one in email that I don't see listed here. You said
It looks like I didn't add a .sln file to the repo. You could create your own and add the .py files to it, or just open the .py files of interest directly, without creating a .sln yourself.
Start Sublime. You might have to run the plugin once. In VS, do Debug>Attach and find pluginhost.exe. This is the process that Sublime runs plugins inside. In "Attach With" box on that dialog, make sure you select "Python" and nothing else. Hit Attach. (If Python does not appear, re-run VS setup and select Python tools. Then try again.)
If you had uninstalled the plugin using package manager, then "installed" it with update.bat (per steps 2 and 4 above) it should be present in %appdata%/sublime text 3/packages/web inspector as loose files, and NOT present in %appdata%\Sublime Text 3\Installed Packages (where the package manager would place it as a zip). If at this point it works within Sublime, you are successfully using it from the loose files. I don't recommend that you clone to that location, but instead run update.bat whenever you change your repo. Does that help? Incidentally, when you run update.bat it is not strictly necessary to close Sublime first. If you open the Sublime console with "Ctrl-`" (ctrl-tick) you will see it detect your change and reload the plugin. This usually works -- however if you have changed global code, I think it is necessary to reopen Sublime in order to cause the plugin to re-initialize completely. Along similar lines, if you make a change, run update.bat, and do not see your change, check the Sublime console for error messages or call stack traces. |
Incidentally, I greatly appreciate your efforts here -- I will have no time to work on this for the foreseeable future, and I believe that is true of the only other contributor @sokolovstas. It's not difficult to work on the code, it's just fiddly to get set up. Also, the reason I put this aside was partly that it was working really well and the code was clean, so it's an appealing codebase to make changes to. |
When program files appears in the browser, it's because we passed empty quotes to launch Chrome, ie., "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 "" instead of "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 You can see this command line in the Properties for the root chrome.exe in process explorer. The run function needs debugging to see why it's doing this. |
One other note -- I think if you launch Chrome yourself (including the debugging port flag) you should be able to attach with Web Inspector and avoid the launch problem. From that point on, you can refresh the page when you need to update it. |
I followed the instructions above to attach the VS debugger to the pluginhost.exe process and I believe I am ready to debug. |
Awesome. You probably want to put a breakpoint in SwiDebugStartChromeCommand.run() as that's where the command is constructed. You might be surprised by how straightforward the code is - most of it maps to individual user commands. You'll quickly become familiar. |
It seems that I have a strange new problem now. I was ready to get some debugging done this morning and I fired up ST3, ran SWI, attached to plugin_host.exe and the VS status bar changes to active for about three seconds and then exits out of the debugger with the following error: The program '[11052] plugin_host.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'. I tried to close all the applications and start again but I seem to get the same result |
For the AV -- strange. Do you have the latest version of Sublime? Do you have the latest version of the Python tools for Visual Studio? Check Tools>Extensions and see if there's an update. It's possible that Dev15 might fix this, but that'd take a while to install and I'm just hypothesizing. |
For "Failed to Create Data Directory" - try putting "chrome_profile" in your plugin settings, and set it to some arbitrary string. That should trigger the code below in swi.py to add user-data-dir parameter which should cause it to not conflict with the regular chrome up.
|
It looks like this works around it:
It used to be possible to just put "foo" or some arbitrary string, but it now seems to make that relative to its install path, where it can't normally write. Perhaps a break in Chrome? Meantime, the above keeps it quiet for me. |
If this is the issue, pending a Chrome fix, we need a change to swi.py at the point I pasted below, to (on Windows) prepend something like the above. |
OK, I am now attached to the plugin_host.exe process so it seems that now I can just hit F11 to start debugging. It looks like I am getting an exception right at the import statements where it can not find a module named sublime. Is this a file that I am missing? ImportError was unhandled by user code |
Hmm, that's just broken. I verified with the latest Sublime and Chrome on Windows, with Visual Studio 2015 Update 2, debugging works fine for me. %appdata%\Sublime Text 3\Installed Packages does not contain Web Inspector, right? it's only in ...Sublime Text3\Packages\Web Inspector. Anything odd about your %PATH% ? I'd almost be tempted to remove Sublime (back up your settings) and remove the Sublime Text 3 folder then reinstall. Since it works for me, they haven't renamed their "sublime" package (which would be strange anyway) so something is wrong with the context in which Sublime is loading packages for you. |
The only things I do differently
For the "import sublime" issue, if it can't be ignored, I can only suggest asking on https://forum.sublimetext.com/ ... I can't repro myself. Let me know how it goes. |
Another thought about "import sublime" -- reduce the package down to the bare minimum -- I've not made a Sublime plugin from scratch but it might simply mean empty the folder down to just swi.py, and edit swi.py down to just that line. See if it still has the problem. Another similar approach - get a sample Sublime plugin, and see if it hits it. Do they now expect you to invoke it by some othe rname than "sublime"? |
Question: After attaching to plugin_host.exe do you start debugging by initiating SWI from inside ST3 or do you just hit F10 in VS15 and start stepping through swi.py? After I attach to plugin_host.exe the stepping option in VS2015 is greyed out. |
I found the following errors in the ActivityLog.xml which look like they are related to the PythonTools plugin so I am going to try uninstalling and the re-installing PT. Also I am running VS 2015 update 3 and you are running update 2 so I don't know if that has something to do with this or not 2016/07/03 10:03:52.166 |
If you get those still after your repair/reinstall, let me know and I'll ask the Python folk internally. Both of them look like they are related to the Python editor, so perhaps not necessarily breaking debugging. For your question: I normally attach, then either set a BP or hit the pause button, then go to Sublime and trigger the plugin (ctrl-shift-R on my machine) so that its Python starts to run. |
When starting a debug session with Ctrl + Shift + R the Chrome application opens properly but a ton of errors pop up in the Sublime console. I have tried creating the test script in different folders but the errors are the same:
[5728:8960:0602/155257:ERROR:cache_util_win.cc(20)] Unable to move the cache: 0
[5728:8960:0602/155257:ERROR:cache_util.cc(134)] Unable to move cache folder C:\Users\dkimble\AppData\Local\Google\Chrome\User Data\ShaderCache\GPUCache to C:\Users\dkimble\AppData\Local\Google\Chrome\User Data\ShaderCache\old_GPUCache_000
[5728:8960:0602/155257:ERROR:cache_creator.cc(129)] Unable to create cache
[5728:8960:0602/155257:ERROR:shader_disk_cache.cc(589)] Shader Cache Creation failed: -2
[Finished in 0.3s]
The text was updated successfully, but these errors were encountered: