[Win32utils-devel] [ win32utils-Bugs-28801 ] unclosed handle in Process.setpriority/getpriority

noreply at rubyforge.org noreply at rubyforge.org
Mon Dec 27 11:32:03 EST 2010


Bugs item #28801, was opened at 2010-12-25 03:02
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=411&aid=28801&group_id=85

Category: win32-process
Group: Code
>Status: Closed
>Resolution: Accepted
Priority: 3
Submitted By: Rafał Michalski (royaltm)
>Assigned to: Daniel Berger (djberg96)
Summary: unclosed handle in Process.setpriority/getpriority 

Initial Comment:
Using Process.setpriority/getpriority was crashing my ruby program.

I think the problem was with unclosed handle from OpenProcess() function.

my patch for lib/win32/process.rb (0.6.4) follows, however the bug exists also in previous releases.


----------------------------------------------------------------------

>Comment By: Daniel Berger (djberg96)
Date: 2010-12-27 09:32

Message:
Ok, I've fixed it in 0.6.5, which I just pushed.

Please note that I've made the API for getpriority and setpriority stricter, i.e. there are no longer any default arguments. This was so that it matched the MRI spec.

Thanks for the report.

Regards,

Dan

----------------------------------------------------------------------

Comment By: Rafał Michalski (royaltm)
Date: 2010-12-27 01:02

Message:
I'm applying this patch since version 0.6.2 in production
environment (though didn't report it until now) and it
servers me right.
I'm using Process.setpriority from ruby program to give more
cpu attention to one of (not ruby) child processes (spawned
with Process.create) which handles serial communication with
card reader device.
Didn't notice any trouble on WinXP and Vista64.


----------------------------------------------------------------------

Comment By: Daniel Berger (djberg96)
Date: 2010-12-26 10:59

Message:
Yeah, I need to clean up getpriority and setpriority in general to more strictly match the current spec.

I think I originally avoided CloseHandle because I seem to recall it causing issues because it would affect the current process somehow. Maybe I'm imagining things, though. I'll definitely take a look.

Thanks,

Dan

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=411&aid=28801&group_id=85


More information about the win32utils-devel mailing list