silent hang - can anyone explain?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

silent hang - can anyone explain?

David Collier
I mistakenly wrote:

    for charIndex = startIndex, #payLoad
    do
        local char = payLoad:subs(charIndex, charIndex)

of course it should have been sub()

my program silently hung - is this an expected consequence of this sort
of misspelling?

David

Reply | Threaded
Open this post in threaded view
|

Re: silent hang - can anyone explain?

Matthew Wild
On 16 October 2012 16:12, David Collier <[hidden email]> wrote:

> I mistakenly wrote:
>
>     for charIndex = startIndex, #payLoad
>     do
>         local char = payLoad:subs(charIndex, charIndex)
>
> of course it should have been sub()
>
> my program silently hung - is this an expected consequence of this sort
> of misspelling?

    Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
    > mystring = "Hello world"
    > return mystring:subs(1,1)
    stdin:1: attempt to call method 'subs' (a nil value)
    stack traceback:
    stdin:1: in main chunk
    [C]: ?

I'll make a guess that you're using Lua inside an application that is
using [lua_]pcall() without appropriate error handling in place to
report the error to you. Another possibility is that the error
happened inside a coroutine, you need to check the return value from
coroutine.resume() in this case.

Regards,
Matthew

Reply | Threaded
Open this post in threaded view
|

Re: silent hang - can anyone explain?

David Collier

Ok - so I gather the silent hang isn't "quite expected" for some subtle
reason I haven't twigged.

> I'll make a guess that you're using Lua inside an application that
> is
> using [lua_]pcall() without appropriate error handling in place to
> report the error to you.

not knowingly - and I get other error messages just fine

> Another possibility is that the error
> happened inside a coroutine, you need to check the return value from
> coroutine.resume() in this case.

Well I'm not intentionally invoking coroutines. Simple single-thread bit
of equipment test s/w running on windoze.

Thanks - will cut bits out of my prog till it says something :-)

David
>
> Regards,
> Matthew
>

Reply | Threaded
Open this post in threaded view
|

Re: silent hang - can anyone explain?

Rena

On 2012-10-16 12:52 PM, "David Collier" <[hidden email]> wrote:
>
>
> Ok - so I gather the silent hang isn't "quite expected" for some subtle
> reason I haven't twigged.
>
> > I'll make a guess that you're using Lua inside an application that
> > is
> > using [lua_]pcall() without appropriate error handling in place to
> > report the error to you.
>
> not knowingly - and I get other error messages just fine
>
> > Another possibility is that the error
> > happened inside a coroutine, you need to check the return value from
> > coroutine.resume() in this case.
>
> Well I'm not intentionally invoking coroutines. Simple single-thread bit
> of equipment test s/w running on windoze.
>
> Thanks - will cut bits out of my prog till it says something :-)
>
> David
> >
> > Regards,
> > Matthew
> >
>

By some coincidence, is payLoad:subs() an actual existing function that loops for a long time? (Maybe payLoad is not the type you expect?) Wouldn't be the first time I've seen such an unlikely-seeming scenario on this list.

Reply | Threaded
Open this post in threaded view
|

Re: silent hang - can anyone explain?

David Collier


> *From:* "Rena" <[hidden email]>
> *To:* <[hidden email]>, "Lua mailing list" <[hidden email]>
> *Date:* Tue, 16 Oct 2012 14:09:05 -0500
>
> On 2012-10-16 12:52 PM, "David Collier" <[hidden email]> wrote:
> >
> >
> > Ok - so I gather the silent hang isn't "quite expected" for some
> > subtle
> > reason I haven't twigged.
> >
> > > I'll make a guess that you're using Lua inside an application
> > that
> > > is
> > > using [lua_]pcall() without appropriate error handling in place
> > to
> > > report the error to you.
> >
> > not knowingly - and I get other error messages just fine
> >
> > > Another possibility is that the error
> > > happened inside a coroutine, you need to check the return value
> > from
> > > coroutine.resume() in this case.
> >
> > Well I'm not intentionally invoking coroutines. Simple
> > single-thread bit
> > of equipment test s/w running on windoze.
> >
> > Thanks - will cut bits out of my prog till it says something :-)
> >
> > David
> > >
> > > Regards,
> > > Matthew
> > >
> >
>
> By some coincidence, is payLoad:subs() an actual existing function
> that
> loops for a long time? (Maybe payLoad is not the type you expect?)
> Wouldn't
> be the first time I've seen such an unlikely-seeming scenario on
> this list.

no - payload is a string and everything works fine if I kill the 's'




>
>
> --
> *Included Files:*
> am2file:001-HTML_Message.html

Reply | Threaded
Open this post in threaded view
|

Re: silent hang - can anyone explain?

Rena

On 2012-10-17 10:36 AM, "David Collier" <[hidden email]> wrote:
>
>
>
> > *From:* "Rena" <[hidden email]>
> > *To:* <[hidden email]>, "Lua mailing list" <[hidden email]>
> > *Date:* Tue, 16 Oct 2012 14:09:05 -0500
> >
> > On 2012-10-16 12:52 PM, "David Collier" <[hidden email]> wrote:
> > >
> > >
> > > Ok - so I gather the silent hang isn't "quite expected" for some
> > > subtle
> > > reason I haven't twigged.
> > >
> > > > I'll make a guess that you're using Lua inside an application
> > > that
> > > > is
> > > > using [lua_]pcall() without appropriate error handling in place
> > > to
> > > > report the error to you.
> > >
> > > not knowingly - and I get other error messages just fine
> > >
> > > > Another possibility is that the error
> > > > happened inside a coroutine, you need to check the return value
> > > from
> > > > coroutine.resume() in this case.
> > >
> > > Well I'm not intentionally invoking coroutines. Simple
> > > single-thread bit
> > > of equipment test s/w running on windoze.
> > >
> > > Thanks - will cut bits out of my prog till it says something :-)
> > >
> > > David
> > > >
> > > > Regards,
> > > > Matthew
> > > >
> > >
> >
> > By some coincidence, is payLoad:subs() an actual existing function
> > that
> > loops for a long time? (Maybe payLoad is not the type you expect?)
> > Wouldn't
> > be the first time I've seen such an unlikely-seeming scenario on
> > this list.
>
> no - payload is a string and everything works fine if I kill the 's'
>
>
>
>
> >
> >
> > --
> > *Included Files:*
> > am2file:001-HTML_Message.html
>

And you haven't unknowingly defined a string.subs ()?

Reply | Threaded
Open this post in threaded view
|

Re: silent hang - can anyone explain?

David Collier


> *From:* "Rena" <[hidden email]>
> *To:* <[hidden email]>, "Lua mailing list" <[hidden email]>
> *Date:* Wed, 17 Oct 2012 19:05:32 -0500
>
> On 2012-10-17 10:36 AM, "David Collier" <[hidden email]> wrote:
> >

>
> And you haven't unknowingly defined a string.subs ()?

I'm not that clever :-)

>
>
> --
> *Included Files:*
> am2file:001-HTML_Message.html

Reply | Threaded
Open this post in threaded view
|

Re: silent hang - can anyone explain?

Robert G. Jakabosky
In reply to this post by David Collier
On Tuesday 16, David Collier wrote:

> I mistakenly wrote:
>
>     for charIndex = startIndex, #payLoad
>     do
>         local char = payLoad:subs(charIndex, charIndex)
>
> of course it should have been sub()
>
> my program silently hung - is this an expected consequence of this
> sort of misspelling?

Lua might be doing a full GC before printing the error.  Run the
program under a debugger and when it hangs pause it and check the
stack trace.  The hang could be cause by some __gc function.

A user of my lua-zmq bindings ran into a similar hang [1].  The hang
happened because two objects where not being closed in the correct
order.  One object still had a live reference, but the other didn't.

An easy way to check is to wrap your main script inside a pcall()

print(pcall(function(...) -- first line

-- Lua code for your main script here.

end, ...)) -- last line


1. https://github.com/Neopallium/lua-zmq/issues/32

--
Robert G. Jakabosky