Bleachbit Portable / Console Hangs in Win2K3-64 SP2 when Called from within Batch (.cmd) files

I'm using Bleachbit portable on a windows 2003 Server (64bit, SP2).

When I run Bleachbit_console.exe -o -c --preset from a fresh command prompt, it continues normally, no errors.

When I run Bleachbit_console.exe -o -c --preset from within a Batch (cmd) file, It frezzes, and I have to press CTRL-C 2 times.


info: starting BleachBit version 0.9.1
warning: cannot find GPLv3 license text file
WARNING: unknown option detect1
WARNING: unknown option detect2
WARNING: unknown option detectfile1
WARNING: unknown option detectfile1
WARNING: unknown option detectfile2
WARNING: unknown option detect1
WARNING: unknown option detect2
WARNING: unknown option detect3
WARNING: unknown option detectfile1
WARNING: unknown option detectfile2
WARNING: unknown option detectfile1
WARNING: unknown option detectfile1
WARNING: unknown option detectfile2
WARNING: unknown option detectfile1
WARNING: unknown option detectfile1
WARNING: unknown option detect1
WARNING: unknown option detect2
WARNING: unknown option detectfile1
WARNING: unknown option detectfile1
WARNING: unknown option detectfile1
WARNING: unknown option detectfile1
WARNING: unknown option detectfile2
WARNING: unknown option detectfile1
WARNING: unknown option detectfile2
WARNING: unknown option detectfile1
WARNING: unknown option detectfile1
WARNING: unknown option detectfile2
WARNING: unknown option detectfile3
WARNING: unknown option detectfile1
WARNING: unknown option detectfile1
WARNING: unknown option detectfile2
WARNING: unknown option detectfile1
WARNING: unknown option detectfile1
WARNING: unknown option detectfile2
WARNING: unknown option detectfile1
WARNING: unknown option detect1
WARNING: unknown option detect2
WARNING: unknown option detectfile2
WARNING: unknown option detectfile1
WARNING: unknown option detectfile2
WARNING: unknown option detectfile3
WARNING: unknown option detectfile1
WARNING: unknown option detectfile1
WARNING: unknown option detectfile2
WARNING: unknown option detectfile1
WARNING: unknown option detect1
WARNING: unknown option detect2
WARNING: unknown option detect1
WARNING: unknown option detect2
WARNING: unknown option detectfile2
WARNING: unknown option detectfile1
WARNING: unknown option detectfile1
WARNING: unknown option detect1
WARNING: unknown option detect2
WARNING: unknown option detect1
WARNING: unknown option detect2
WARNING: unknown option detectfile2
WARNING: unknown option detectfile1
WARNING: unknown option detectfile2
WARNING: unknown option detectfile1
WARNING: unknown option detectfile1
debug: clean_operation('google_chrome'), options = '[u'cache', u'cookies', u'dom', u'form_history', u'history', u'search_engines', u'session']'
debug: running cmd ['wmic', 'path', 'win32_process', 'where', u"caption='chrome.exe'", 'get', 'Caption']
********CTRL-C PRESSED HERE********
Exception while running operation 'google_chrome': ''
Traceback (most recent call last):
File "bleachbit\Worker.pyo", line 305, in run_operations
File "bleachbit\Worker.pyo", line 133, in clean_operation
File "bleachbit\Cleaner.pyo", line 159, in is_running
File "bleachbit\Windows.pyo", line 313, in is_process_running
File "bleachbit\Windows.pyo", line 369, in is_process_running_wmic
File "bleachbit\General.pyo", line 143, in run_external
File "subprocess.pyo", line 670, in communicate
File "subprocess.pyo", line 895, in _communicate
File "threading.pyo", line 594, in join
File "threading.pyo", line 216, in wait
KeyboardInterrupt
Exception while running operation 'google_chrome': ''
debug: clean_operation('firefox'), options = '['cache', 'cookies', 'dom', 'download_history', 'forms', 'passwords', 'session_restore', 'site_preferences', 'url_history']'
debug: running cmd ['wmic', 'path', 'win32_process', 'where', "caption='firefox.exe'", 'get', 'Caption']
********CTRL-C PRESSED HERE********
Exception while running operation 'firefox': ''
Traceback (most recent call last):
File "bleachbit\Worker.pyo", line 305, in run_operations
File "bleachbit\Worker.pyo", line 133, in clean_operation
File "bleachbit\Cleaner.pyo", line 159, in is_running
File "bleachbit\Windows.pyo", line 313, in is_process_running
File "bleachbit\Windows.pyo", line 369, in is_process_running_wmic
File "bleachbit\General.pyo", line 143, in run_external
File "subprocess.pyo", line 670, in communicate
File "subprocess.pyo", line 895, in _communicate
File "threading.pyo", line 594, in join
File "threading.pyo", line 216, in wait
KeyboardInterrupt
Exception while running operation 'firefox': ''
Disk space recovered: 0
Files deleted: 0
Errors: 2

When I run Bleachbit.exe -o -c --preset either from a fresh command prompt or a batch file, I get a popup about errors, and the follwing is posted to the log file.


Traceback (most recent call last):
File "bleachbit\Worker.pyo", line 305, in run_operations
File "bleachbit\Worker.pyo", line 133, in clean_operation
File "bleachbit\Cleaner.pyo", line 159, in is_running
File "bleachbit\Windows.pyo", line 313, in is_process_running
File "bleachbit\Windows.pyo", line 369, in is_process_running_wmic
File "bleachbit\General.pyo", line 141, in run_external
File "subprocess.pyo", line 587, in __init__
File "subprocess.pyo", line 706, in _get_handles
File "subprocess.pyo", line 751, in _make_inheritable
WindowsError: [Error 6] The handle is invalid
Traceback (most recent call last):
File "bleachbit\Worker.pyo", line 305, in run_operations
File "bleachbit\Worker.pyo", line 133, in clean_operation
File "bleachbit\Cleaner.pyo", line 159, in is_running
File "bleachbit\Windows.pyo", line 313, in is_process_running
File "bleachbit\Windows.pyo", line 369, in is_process_running_wmic
File "bleachbit\General.pyo", line 141, in run_external
File "subprocess.pyo", line 587, in __init__
File "subprocess.pyo", line 706, in _get_handles
File "subprocess.pyo", line 751, in _make_inheritable
WindowsError: [Error 6] The handle is invalid

Forums: 

OK, some more information....

above issue was caused when I was logged in either as Local Administrator, or a user with Administrator Rights.

If I however ran the same with a regular User (or power User), The only error I would get is that Firefox is already running, and it cannot be clensed.

For the record, I'm using FF 9.0.1, as 10.0.2 has some compatibility issues with a couple of my plugins.

This seems to be similar to the bug: http://bleachbit.sourceforge.net/forum/bleachbit-hangs-when-trying-clean...

BleachBit 0.9.1 on 64-bit Windows runs wmic to find out whether another process is running. (In your case, that other process is Google Chrome or Firefox.) BleachBit 0.9.0 fixed a problem where the output from the wmic command was too large, and this caused a similar freeze. However, that should be fixed.

To help narrow down the issue, would you please run this command, find the file on your desktop, copy the results, and paste the results here?

wmic path win32_process where caption='chrome.exe' get Caption > %USERPROFILE%\desktop\processes.txt

Sorry Andrew,
Forgot to mention I had verified neither Firefox nor Chorme were running in either Test.
This is a Fresh install if Win2003 64-bit Data Centre Edition R2, with all Windows Updates installed, but _NO_ .net

I have since installed 0.9.1 regularly, and same results when run from a batch file as administrator, or a user that's part of the administrator's group.
If I run Bleachbit through explorer, it works fine ONLY if I'm the local administrator.

And no reslut for the WMIC ie: No Instance(s) Available.

Right after a reboot, I ran my batchfile, and while Bleachbit_console was frozen, I opened another command prompt, and I did do wmic path win32_process get Caption earlier.

These are the results.


Caption
System Idle Process
System
smss.exe
csrss.exe
winlogon.exe
services.exe
lsass.exe
svchost.exe
svchost.exe
svchost.exe
svchost.exe
svchost.exe
spoolsv.exe
msdtc.exe
svchost.exe
svchost.exe
svchost.exe
explorer.exe
ctfmon.exe
ctfmon.exe
svchost.exe
wmiprvse.exe
cmd.exe
cmd.exe
Choice.exe
bleachbit_console.exe
wmic.exe
cmd.exe
csrss.exe
winlogon.exe
rdpclip.exe
wmiprvse.exe
wmic.exe
<./code>

The result No Instance(s) Available. is good: this just means that it didn't find chrome.exe was running. I get the same thing here on Windows Server 2003 Standard Edition 32-bit, and BleachBit seems OK. Your longer output of WMIC looks normal too.

I'm not yet sure what is causing BleachBit to not be able to communicate with the WMIC subprocess, and it seems you are the only person with this problem. So for now I would propose a workaround. In the BleachBit application directory is a folder called cleaners with files firefox.xml and google_chrome.xml. Edit these files and delete the lines with firefox.exe and chrome.exe: this prevents BleachBit from checking that the browsers are currently running.

OK,

I was able to do it for CHROME, but not FIREFOX, there is no firefox.xml
Even checked a fresh install.. and not there either...

The trick did let chrome to continue though :)

Sorry, I remembered that Firefox and OpenOffice.org are the last cleaners I need to move from Python code to CleanerML (XML), so there is no firefox.xml yet.

I read your post more carefully and you made the distinction between command line and batch file, and I tested only the command line. I have been busy, so this may take me a little while to figure out. I filed this here https://bugs.launchpad.net/bleachbit/+bug/938410 so it does not get lost

Hopefully there will be an XML version ready soon :)
That will be a workaround I can use :)

And thanks, I will be keeping an eye out for it.