Bug #2655

win32OLE processes lose their connection?

Added by Roger Pack over 5 years ago. Updated over 4 years ago.

[ruby-core:27823]
Status:Rejected
Priority:Normal
Assignee:Masaki Suketa
ruby -v:ruby 1.9.2dev (2010-01-25 trunk 26409) [i386-mingw32] Backport:

Description

=begin
The following code works in 1.8.6, not in 1.9.x...

require 'win32ole'
wmi = WIN32OLE.connect("winmgmts://")
processes = wmi.ExecQuery("select * from win32_process")
proc = nil
t = []
processes.each {|process|
t << Thread.new { sleep 0.1
process.setPriority 32
}
}

t.each{|t| t.join}

error is:

E:\dev\ruby\windows_ionice\bin>ruby -v bad.rb
ruby 1.9.2dev (2010-01-25 trunk 26409) [i386-mingw32]
bad.rb:12: warning: shadowing outer local variable - t
bad.rb:8:in method_missing': unknown property or method:setPriority' (WIN32OLERuntimeError)
HRESULT error code:0x80020006
Unknown name.
from bad.rb:8:in block (2 levels) in <main>'
from E:/installs/ruby_trunk_installed/lib/ruby/1.9.1/win32ole.rb:13:in
call'
from E:/installs/ruby_trunk_installed/lib/ruby/1.9.1/win32ole.rb:13:in `block in initialize'
=end

History

#1 Updated by Yusuke Endoh about 5 years ago

  • Status changed from Open to Assigned
  • Assignee set to Masaki Suketa

=begin
Hi, Masaki Suketa

Could you take a look at this ticket?

--
Yusuke Endoh mame@tsg.ne.jp
=end

#2 Updated by Masaki Suketa about 5 years ago

=begin
To fix this issue, I think Win32OLE should be MTA model instead of STA model.
I had tried MTA instead of STA and fixed this issue, but I have another two
following issues:

(1) WIN32OLE_EVENT does not work very well.
(2) I can't use CoRegisterMessageFilter in MTA model, so I have to fix the
issue in without CoRegisterMessageFilter.

And I have not fixed these issues yet.

I'm not sure, but I think I could fix (1) by using critical section
but I don't know how to fix (2).

=end

#3 Updated by Yusuke Endoh about 5 years ago

  • Status changed from Assigned to Rejected

=begin
Hi,

I think Masaki meant that this bug cannot be fixed.
Do not use win32ole with threads, at least for a while.

If Roger or anyone have an idea to fix this issue, please send us
a patch!

--
Yusuke Endoh mame@tsg.ne.jp
=end

Also available in: Atom PDF