Closed rwaffen closed 1 year ago
Looking at that line, it seems I already rescue Errno::EACCES
, Errno::EOVERFLOW
, EOFError
, and RangeError
but not Errno::EBADF
. That error could mean that the file isn't available for reading by the time the loop actually gets to it.
You can modify the line at 346 to include Errno::EBADF
. Temporarily add a debug print in the rescue block if you want to see which file it is.
Oops, didn't mean to close it, hit the wrong button.
when i add something like this
rescue Errno::EACCES, Errno::EOVERFLOW, EOFError, RangeError
# Skip this if we don't have proper permissions, if there's
# no associated environment, or if there's a largefile issue.
rescue Errno::EBADF
puts "file not readable #{file}"
rescue Errno::ENOENT
next # The process has terminated. Bail out!
end
irb(main):003:0> ProcTable.ps { |process| pp process.comm }
file not readable 0
"sched"
file not readable 5
"zpool-rpool"
file not readable 6
"kmem_task"
"init"
file not readable 2
"pageout"
file not readable 3
"fsflush"
file not readable 7
"intrd"
file not readable 8
"vmtasks"
file not readable 9
"postwaittq"
"ibmgmtd"
"svc.startd"
"svc.configd"
this are all 0 byte /proc/**/as files. so maybe check first if file is 0 byte and skip, before try reading it?
You can try wrapping that block with a if File.size(file) > 0
check, but the check itself might cause an Errno::EBADF
, you'll have to experiment.
okay, i will try this out and then come back with a PR
@rwaffen Looking back at your Vagrant file, what version of Ruby was it using?
the ruby from puppet 6.28.0
root@solaris11:~# /opt/puppetlabs/puppet/bin/ruby -v
ruby 2.5.9p229 (2021-04-05 revision 67939) [i386-solaris2.11]
i run in the following error and dont know what to do. did i do something wrong?
some code runs on a linux vm without problems.
Environment
How to reproduce:
vagrant solaris 11.4 with puppet for ruby 2.5.x