Project

General

Profile

Actions

Bug #2655

closed

win32OLE processes lose their connection?

Added by rogerdpack (Roger Pack) almost 15 years ago. Updated over 13 years ago.

Status:
Rejected
Target version:
-
ruby -v:
ruby 1.9.2dev (2010-01-25 trunk 26409) [i386-mingw32]
Backport:
[ruby-core:27823]

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

Actions #1

Updated by mame (Yusuke Endoh) over 14 years ago

  • Status changed from Open to Assigned
  • Assignee set to suke (Masaki Suketa)

=begin
Hi, Masaki Suketa

Could you take a look at this ticket?

--
Yusuke Endoh
=end

Actions #2

Updated by suke (Masaki Suketa) over 14 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 [ruby-dev:35278] 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

Actions #3

Updated by mame (Yusuke Endoh) over 14 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
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0