Bug #2780

"Handle is invalid" when accessing the file system from different threads (win32)

Added by Dennis Ranke almost 2 years ago. Updated 10 months ago.

[ruby-core:28298]
Status:Open Start date:02/23/2010
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:core
Target version:-
ruby -v:ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-mswin32]

Description

Sometimes when building projects using our own build tool written in ruby, the ruby interpreter crashes on us. The build tool uses multiple threads to compile files in parallel. (Like "make -j 2")

First we got this backtrace:

C:/projekte/tools/code/animation/AnimationConverter/helpers/lace/lib/lace/dependencies.rb:32: [BUG] Das Handle ist ung³ltig.
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32]
-- control frame ----------
c:0013 p:---- s:0052 b:0052 l:000051 d:000051 CFUNC :initialize
c:0012 p:---- s:0050 b:0050 l:000049 d:000049 CFUNC :open
c:0011 p:0042 s:0045 b:0045 l:000044 d:000044 METHOD C:/projekte/tools/code/animation/AnimationConverter/helpers/lace/lib/lace/dependencies.rb:32
c:0010 p:0497 s:0039 b:0039 l:000bf0 d:002164 BLOCK C:/projekte/tools/code/shared/modules_compiler/compiler/win32/msvc/vc13106030/msvcbase.def:154
c:0009 p:0038 s:0029 b:0029 l:000028 d:000028 METHOD C:/projekte/tools/code/animation/AnimationConverter/helpers/lace/lib/lace/compilerbase.rb:200
c:0008 p:0043 s:0022 b:0022 l:000021 d:000021 METHOD C:/projekte/tools/code/shared/modules_compiler/compiler/win32/msvc/vc13106030/msvcbase.def:104
c:0007 p:0185 s:0016 b:0016 l:001d68 d:000015 BLOCK C:/projekte/tools/code/animation/AnimationConverter/helpers/lace/lib/lace/compilerbase.rb:282
c:0006 p:---- s:0013 b:0013 l:000012 d:000012 FINISH
c:0005 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC :loop
c:0004 p:0009 s:0008 b:0008 l:001d68 d:000007 BLOCK C:/projekte/tools/code/animation/AnimationConverter/helpers/lace/lib/lace/compilerbase.rb:269
c:0003 p:0007 s:0006 b:0006 l:001d8c d:000005 BLOCK C:/projekte/tools/code/animation/AnimationConverter/helpers/lace/lib/lace/compilerbase.rb:221
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP
---------------------------
-- Ruby level backtrace information-----------------------------------------
C:/projekte/tools/code/animation/AnimationConverter/helpers/lace/lib/lace/compilerbase.rb:200:in `read'
C:/projekte/tools/code/animation/AnimationConverter/helpers/lace/lib/lace/compilerbase.rb:200:in `check_optimized_dependencies'
C:/projekte/tools/code/shared/modules_compiler/compiler/win32/msvc/vc13106030/msvcbase.def:104:in `compile'
C:/projekte/tools/code/animation/AnimationConverter/helpers/lace/lib/lace/compilerbase.rb:282:in `block (2 levels) in process_files'
C:/projekte/tools/code/animation/AnimationConverter/helpers/lace/lib/lace/compilerbase.rb:269:in `loop'
C:/projekte/tools/code/animation/AnimationConverter/helpers/lace/lib/lace/compilerbase.rb:269:in `block in process_files'
C:/projekte/tools/code/animation/AnimationConverter/helpers/lace/lib/lace/compilerbase.rb:221:in `block (2 levels) in threaded'
[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

This is in a File.read call.
I have then wrapped this File.read in a mutex and now get (less frequently):

C:/projekte/xxx/code_buildmachine/local/helpers/lace/lib/lace/dependencies.rb:31: [BUG] Das Handle ist ung³ltig. 
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-mswin32] 
-- control frame ---------- 
c:0018 p:---- s:0066 b:0065 l:000064 d:000064 CFUNC  :expand_path 
c:0017 p:0027 s:0061 b:0061 l:000043 d:000060 BLOCK  C:/projekte/xxx/code_buildmachine/local/helpers/lace/lib/lace/dependencies.rb:31 
c:0016 p:---- s:0058 b:0058 l:000057 d:000057 FINISH 
c:0015 p:---- s:0056 b:0056 l:000055 d:000055 CFUNC  :each 
c:0014 p:0029 s:0053 b:0053 l:000043 d:000052 BLOCK  C:/projekte/xxx/code_buildmachine/local/helpers/lace/lib/lace/dependencies.rb:30 
c:0013 p:---- s:0049 b:0049 l:000048 d:000048 FINISH 
c:0012 p:---- s:0047 b:0047 l:000046 d:000046 CFUNC  :map 
c:0011 p:0016 s:0044 b:0044 l:000043 d:000043 METHOD C:/projekte/xxx/code_buildmachine/local/helpers/lace/lib/lace/dependencies.rb:28 
c:0010 p:0379 s:0038 b:0038 l:001608 d:000aec BLOCK  C:/projekte/xxx/code_buildmachine/stable/modules_compilers/compiler/xb360/module.lace:61 
c:0009 p:0070 s:0028 b:0028 l:000027 d:000027 METHOD C:/projekte/xxx/code_buildmachine/local/helpers/lace/lib/lace/compilerbase.rb:202 
c:0008 p:0043 s:0022 b:0022 l:001608 d:001608 METHOD C:/projekte/xxx/code_buildmachine/stable/modules_compilers/compiler/xb360/module.lace:18 
c:0007 p:0185 s:0016 b:0016 l:000e40 d:000015 BLOCK  C:/projekte/xxx/code_buildmachine/local/helpers/lace/lib/lace/compilerbase.rb:283 
c:0006 p:---- s:0013 b:0013 l:000012 d:000012 FINISH 
c:0005 p:---- s:0011 b:0011 l:000010 d:000010 CFUNC  :loop 
c:0004 p:0009 s:0008 b:0008 l:000e40 d:000007 BLOCK  C:/projekte/xxx/code_buildmachine/local/helpers/lace/lib/lace/compilerbase.rb:270 
c:0003 p:0007 s:0006 b:0006 l:002074 d:000005 BLOCK  C:/projekte/xxx/code_buildmachine/local/helpers/lace/lib/lace/compilerbase.rb:222 
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP   
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH 

Ie. the same error in a File.expand_path. ("Das Handle ist ung³ltig." translates to "The handle is invalid.") This was tested on Windows XP.

History

Updated by Roger Pack almost 2 years ago

do you have a small reproducible test case by chance?

Also available in: Atom PDF