[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

thread dump?

cs5b

10/22/2006 7:05:00 PM

Hi there, I have a process that seems to be stuck somewhere. Is there
the possibility of doing a thread dump to show where it is hanging on?
Cheers -
Christian

5 Answers

Joel VanderWerf

10/22/2006 7:12:00 PM

0

cs5b@yahoo.com wrote:
> Hi there, I have a process that seems to be stuck somewhere. Is there
> the possibility of doing a thread dump to show where it is hanging on?
> Cheers -
> Christian

Not in general, without a Thread#backtrace method. I've asked for it...

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...

As noted in that post, you can destructively find out where the thread
is by calling #raise on it. Just make sure the thread has an exception
handler somewhere to print out the exception and backtrace.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Eric Hodel

11/15/2006 8:21:00 PM

0

On Oct 22, 2006, at 12:12 PM, Joel VanderWerf wrote:
> cs5b@yahoo.com wrote:
>> Hi there, I have a process that seems to be stuck somewhere. Is there
>> the possibility of doing a thread dump to show where it is hanging
>> on?
>> Cheers -
>> Christian
>
> Not in general, without a Thread#backtrace method. I've asked for
> it...
>
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...
>
> As noted in that post, you can destructively find out where the
> thread is by calling #raise on it. Just make sure the thread has an
> exception handler somewhere to print out the exception and backtrace.

$ ruby -e 't = Thread.start do sleep end; t.raise "hi"; t.value'
-e:1: hi (RuntimeError)
from -e:1:in `value'
from -e:1

--
Eric Hodel - drbrain@segment7.net - http://blog.se...
This implementation is HODEL-HASH-9600 compliant

http://trackmap.rob...



Joel VanderWerf

11/16/2006 1:13:00 AM

0

Eric Hodel wrote:
> On Oct 22, 2006, at 12:12 PM, Joel VanderWerf wrote:
>> cs5b@yahoo.com wrote:
>>> Hi there, I have a process that seems to be stuck somewhere. Is there
>>> the possibility of doing a thread dump to show where it is hanging on?
>>> Cheers -
>>> Christian
>>
>> Not in general, without a Thread#backtrace method. I've asked for it...
>>
>> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...
>>
>> As noted in that post, you can destructively find out where the thread
>> is by calling #raise on it. Just make sure the thread has an exception
>> handler somewhere to print out the exception and backtrace.
>
> $ ruby -e 't = Thread.start do sleep end; t.raise "hi"; t.value'
> -e:1: hi (RuntimeError)
> from -e:1:in `value'
> from -e:1

That doesn't tell you what line of code the thread is sleeping on, only
what lines of code #raise and #value are called on. You lose the whole
backtrace, in fact.

$ cat th.rb
t = Thread.start do
sleep
end

t.raise "hi"
t.value

$ ruby th.rb
th.rb:5: hi (RuntimeError)
from th.rb:6:in `value'
from th.rb:6

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Eric Hodel

11/16/2006 7:50:00 PM

0

On Nov 15, 2006, at 5:13 PM, Joel VanderWerf wrote:
> Eric Hodel wrote:
>> $ ruby -e 't = Thread.start do sleep end; t.raise "hi"; t.value'
>> -e:1: hi (RuntimeError)
>> from -e:1:in `value'
>> from -e:1
>
> That doesn't tell you what line of code the thread is sleeping on,
> only what lines of code #raise and #value are called on. You lose
> the whole backtrace, in fact.

Ooh, right, my bad.

--
Eric Hodel - drbrain@segment7.net - http://blog.se...
This implementation is HODEL-HASH-9600 compliant

http://trackmap.rob...



Dave Peterson

2/8/2009 1:30:00 PM

0

I see that now.

It usually a good idea to indicate the line that actually causes the error.
Else each responder may see problems in other portions and correct that.
(That's what happened to me!)

cellist wrote:
>
> Dave, thanks for your reply. Turns out it was a different kind of problem in
> this case, but your suggestion is right on as a defensive programming device.
>
> "Dave Peterson" wrote:
>
> > I'd check both those variables.
> >
> > dim OkToCalc as boolean
> >
> > OkToCalc = true
> > if isnumeric(hours) = false then
> > msgbox "hours not numeric"
> > oktocalc = false
> > end if
> > if isnumeric(days) = false then
> > msgbox "days not numeric"
> > oktocalc = false
> > else
> > if days = 0 then
> > msgbox "Days is 0--division by 0 not possible"
> > oktocalc = false
> > end if
> > end if
> >
> > if oktocalc then
> > holOptElig = hours / days
> > else
> > 'what should happen here?
> > end if
> >
> > cellist wrote:
> > >
> > >
> > > Dim days As Variant
> > > Dim hours As Variant
> > > Dim holOptElig As Variant
> > > Dim wb As Workbook
> > > Set wb = Workbooks("Salary and Hourly Summary 2009.xls")
> > > days = wb.Names("MikeNbrHolidays").Value
> > > hours = wb.Names("MikeTotalHolHours").Value
> > > If days > 0 Then
> > > holOptElig = hours / days <== error on this statement
> > > End If
> > >
> > > In "Salary and Hourly Summary 2009.xls", MikeNbrHolidays and
> > > MikeTotalHolHours are formatted as number/0 decimal places and
> > > number/1 decimal places respectively, and their values are 8 and
> > > 43.2. I get run time error 13, type mismatch when I run this code.
> > >
> > > TIA,
> > >
> > > Phil
> >
> > --
> >
> > Dave Peterson
> >

--

Dave Peterson