How to ungracefully kill a program in Windows? - google-chrome

I am looking to ungracefully kill a program (Chrome) in Windows 7. Chrome has a read-lock on a .tmp file that I want to make a copy of. If I exit Chrome gracefully Chrome deletes the .tmp file as it exits.
How can I immediately kill the program without letting chrome delete my file?

It probably uses a WinAPI temporary file, so you can't:
Check http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%28v=vs.85%29.aspx
Specifying the FILE_ATTRIBUTE_TEMPORARY attribute causes file systems to avoid writing data back to mass storage if sufficient cache memory is available, because an application deletes a temporary file after a handle is closed. In that case, the system can entirely avoid writing the data. Although it does not directly control data caching in the same way as the previously mentioned flags, the FILE_ATTRIBUTE_TEMPORARY attribute does tell the system to hold as much as possible in the system cache without writing and therefore may be of concern for certain applications.
You're best best is to try to copy the file while chrome is still running...
Or put a wrapper between chrome and WinAPI to override the CreateFile call so it doesn't create it as a temporary file.

First, in Chrome, use the shortcut key "Shift+Esc" to pop up the Chrome's Task Manager and kill any other processes than "Browser" (the only one that can't be killed using that).
Then, open Windows Task Manager and kill the only one "chrome.exe" that is left behind.

Download a software called unlocker from google.
http://www.filehippo.com/download_unlocker/
Go to start -> search from "chrome" and go the file location. Generally this
C:\Users\\AppData\Local\Google
Right click on google folder and click unlocker. Click all the open handles and then start the chrome. It works!!

Related

PhpStorm starts indexing files on each launch

I am not sure if this is desired behaviour, but PhpStorm (8.0.3) proceeds to index all files and directories each time I open the IDE. The indexing takes too long - half hour and more. During that time I'm not able to access many configuration options or use "Go to definition" option.
It is very irritating. Shouldn't PhpStorm somehow cache the indices so that it does not go through the whole process over and over again?
It seems that the problem grew over time and at this time it totally paralizes my ability to work on projects.
Is there a solution to it that you know of?
is this problem still current? It's more than year since question, so it could be fixed already.
There is no reliable way to say why it's happenings without seeing the logs.
You may try this:
Close IDE (or this project at least)
Backup and delete .idea subfolder (this project settings)
Launch IDE and using "Open" point to the project root -- IDE will create new project from those files
Reconfigure your project as needed
Restart IDE / close-reopen project (do what you did in the past where it lead to project re-indexing)
It's better now?
If yes, and you have not re-configured ALL aspects of the project yet -- then you may re-use some of the files from previously
made backup (while IDE/project is closed, of course)
Try right-clicking file -> invalidate caches and restart. It worked for me!
File ==> Manage IDE Settings ==> Restore Default Settings
And now it loads rapidly
I had the same problem after searching a while I understood that .gitignore plugin caused it.
After disabling mentioned plugin ide backed to work correctly again.

intercepting chrome.exe causes chrome not to work

I have numerous programs that launch the current web browser on constructed HTML files, and it needs to open in a new window. Many places in the registry reference chrome.exe. There are so many it's hit or miss editing each to have "--new-window". I renamed chrome.exe to chrome_original.exe and replaced chrome.exe with a program I made. What my program does is pass command line arguments to chrome_original.exe, adding "--new-window" if not already present. A config file is read for options. For instance I can keep a log of invocations. There are times when adding "--new-window" is not appropriate, which can be determined by examining the log.
On my development machine the strategy works excellent, but on other machines it doesn't. On the other machines chrome loads, but just sits there with the wheel spinning. Does it test to see if the exe being run is chrome.exe? Why does it work on my development machine?
If chrome updates itself with a new version, putting things back like they were, when I redeploy my exe it will take care of that.
I need to get this working if anyone has an idea why chrome will just sit with the wheel spinning and not load a page. Thanks
To analyze the problem I recommend that you install Process Explorer from www.sysinternals.com.
There should be no Chrome "sitting around with the wheel spinning".
In Process Explorer find out which is the process, double click it and in the first tab in the window that opens you see the command line.
Compare it with the command line on the computer where it works.
Process Explorer gives you much more information, like for example the environment variables. I saw in the case of Firefox that Environment variables may be very relevant. For example when you start Firefox by your program and do not set the working directory correctly it may hang.
I resolved my issue. Chrome also runs as a background process, sitting in the tray, utilizing the same exe. When loaded, the exe file is not held open. Having the exe already loaded as one file name, then loading again as a different file name, no doubt causes confusion. What was already loaded needed to be unloaded, first. In addition, the auto start registry key value needed to be updated with the new exe file name.
I have yet to see what will happen when chrome updates itself automatically with a new version. There's a good chance the launching utility will be overwritten. Some tweaking will need to be done.
Using a launcher for chrome to intercept invocations works really well and is a good approach to always having a new window when one is wanted.

Chrome running out of memory

I've developed a Chrome Extension that cycles through approximately 1500-2000 pages to collect information from a website and push it onto my own server. I use a Chrome extension, as given the requirements it's much easier to configure than making and parsing from the server side.
The extension is used only for internal purposes and we trigger this job using the chrome.alarm API to run at 3:00 am every day. This alarm when triggers pops open a new tab and runs through the 1500-2000 pages. The problem is when we check in the morning we see the SNAP dialogue after the extension has cycled through about 1500 pages (approx 3/4). I'm presuming this is due to the memory demand placed on Chrome to maintain such an unusually large history?
My question is, what would be the best way to mitigate this? Presumably killing the tab and reopening (after x number of pages) would work but that would slow down the feed and require quite a bit of code re-factoring. Is there any way you can force Chrome to dump the history and would doing so free memory in the immediate session?
Just to add some context, I am running this on a extra small VM with only 1 GB of memory. I appreciate I could upgrade the VM but that really just defers the problem.
It's hard to make a solid recommendation without seeing your code, but here's something a bit more general:
The problem is likely the information that is being collected. It continues to build up in memory until you run out. You might consider saving the results to local storage using Chrome's unlimited storage capability. In manifest file:
"permissions": [
"unlimitedStorage"
],
What I would probably do is save to local storage after every page, or something similar, and then reset the array (or whatever you're using).
UPDATE
If indeed history is the problem, you could consider deleting it on the fly. This function will delete entries for a specific URL:
https://developer.chrome.com/extensions/history.html#method-deleteUrl

Dumping plugin memory of a browser

How can I dump a memory of a plugin running inside a browser. For example, I want to analyze the memory of acrobat reader which is running inside chrome.
Thanks in advance.
Generally in case of most common browsers plugins are dynamic librarys loaded into the process of the browser. So you need to attach to that process with a debugger and then go to the module that is the plugin.
For chrome and pdf reader:
Chrome spawns a new process for almost everything, so first you need to load up any pdf in the browser so the plugin gets loaded. Then you can find the matching PID for that tab via the integrated taskmanager from chrome. When you attach to this process with a debugger, you should see the module "pdf", which is a dll located in the chrome installation directory and I believe is a modified version of acrobat reader.
Depends on what you mean by memory dump, and what exactly you're looking to do with it. There are tools such as Memoryze that you can dump the memory of a running process. I've used it forensically but I've never tried to take said dump and throw it in IDA.
You could also attach a debugger and get at memory that way. It all depends what you're trying to analyze/reverse.

What does the Google Chrome exactly do when a new tab is opened?

Today, i observed an interesting behavior. I am using windows XP-sp3 OS.
When i open a new tab in Google Chrome & view the task manager, a new process is created.
But, after some time, this process is terminated.
Why it is showing such kind of behavior? Is it due to system call vfork()? Does the child process immediately call exec()?
Does it happen only with Google Chrome or all other browsers behave in a similar fashion?
AFAIK Chrome maintains one process for each tab, also one process for some plugins too. They preferred multi-process architecture over multi-threaded one because when you are making network application which communicate with network all the time, you can expect to receive packets which can garble the memory. So having multi-process will prevent all but one process, as opposed to multi-threaded will kill the the tabs.
You can enlighten your self on following blog:
http://blog.chromium.org/2008/09/multi-process-architecture.html