Hi Ray, I would just break with VS and switch to the Interpreter Thread to see where it is and what it is waiting for. But I'm not sure if you can do that with only the Express Version of VS. Regards TK
Group: DynoMotion |
Message: 6510 |
From: himykabibble |
Date: 1/18/2013 |
Subject: Re: Interpreter.Interpret |
Tom,
I have the full VS2008. I'll see if I can figure out how to do that.
Is there some initialization I should have to do after a re-connect? I do not re-create the Controller, CoordMotion or Interpreter objects, nor the KM_IO object. I just re-do my own initialization of their properties, exactly as I do on first connect.
Regards,
Ray L.
--- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
>
> Hi Ray,
>
> I would just break with VS and switch to the Interpreter Thread to see where it is and what it is waiting for. But I'm not sure if you can do that with only the Express Version of VS.
>
> Regards
> TK
>
>
>
>
> ________________________________
> From: himykabibble
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, January 17, 2013 10:45 PM
> Subject: [DynoMotion] Interpreter.Interpret
>
>
> Â
> Tom,
>
> I'm down to one last bug that really has me stumped. My app starts up properly first time, every time, whether the board is connected or not. If not connected, it waits until the board is plugged in and initialized, correctly detects its presence, connects and initializes everything it needs to, and the app works properly. If the board is then unplugged, it detects this disconnect, E-Stops, and waits for it to return. When the board is again plugged in, it is again detected and initialized, *except* it hangs at the very end of the app initialization. Almost the last thing in my initialization is running an MDI line to set some default modal states. The call to Interpreter.Interpret does no throw any exceptions, yet I never get the InterpreterDone callback, which I use to know when the initialization is done. If I break into the debugger when it's hung, and FORCE it to think the Interpreter has completed, then all is well, and the app works as it
> should.
>
> Is there anything you can think of that could cause the Interpreter to accept a G-code file without complaint, but then NOT execute it correctly, and issue the Done callback? ALL of the initialization code is identical for the first connection, and the second one, yet the second one ALWAYS fails in the manner described above. Since I'm not getting any exceptions or other error indications, I'm stumped as to how to go any further.
>
> Regards,
> Ray L.
>
|
|
Group: DynoMotion |
Message: 6513 |
From: Tom Kerekes |
Date: 1/18/2013 |
Subject: Re: Interpreter.Interpret |
Hi Ray,
I can't think of any. Obviously you can normally run multiple MDI commands without doing any special re-initialization.
Regards TK
Group: DynoMotion |
Message: 6514 |
From: himykabibble |
Date: 1/18/2013 |
Subject: Re: Interpreter.Interpret |
Man! I hate it when this happens! I set out to debug this, and now it's doing something different! When I try to load the Init program following a re-connect, it's hanging in a call to WaitToken, made from within KM_dotnet_Interop_CompileAndLoadCoff. What could I be doing that would cause that? It never happens on the first connect.
Regards,
Ray L.
--- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
>
> Hi Ray,
>
> I can't think of any. Obviously you can normally run multiple MDI commands without doing any special re-initialization.
>
> Regards
> TKÂ
>
>
>
> ________________________________
> From: himykabibble
> To: DynoMotion@yahoogroups.com
> Sent: Friday, January 18, 2013 10:45 AM
> Subject: [DynoMotion] Re: Interpreter.Interpret
>
>
> Â
> Tom,
>
> I have the full VS2008. I'll see if I can figure out how to do that.
>
> Is there some initialization I should have to do after a re-connect? I do not re-create the Controller, CoordMotion or Interpreter objects, nor the KM_IO object. I just re-do my own initialization of their properties, exactly as I do on first connect.
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> >
> > Hi Ray,
> >
> > I would just break with VS and switch to the Interpreter Thread to see where it is and what it is waiting for.ÃÂ But I'm not sure if you can do that with only the Express Version of VS.
> >
> > Regards
> > TK
> >
> >
> >
> >
> > ________________________________
> > From: himykabibble
> > To: DynoMotion@yahoogroups.com
> > Sent: Thursday, January 17, 2013 10:45 PM
> > Subject: [DynoMotion] Interpreter.Interpret
> >
> >
> > ÃÂ
> > Tom,
> >
> > I'm down to one last bug that really has me stumped. My app starts up properly first time, every time, whether the board is connected or not. If not connected, it waits until the board is plugged in and initialized, correctly detects its presence, connects and initializes everything it needs to, and the app works properly. If the board is then unplugged, it detects this disconnect, E-Stops, and waits for it to return. When the board is again plugged in, it is again detected and initialized, *except* it hangs at the very end of the app initialization. Almost the last thing in my initialization is running an MDI line to set some default modal states. The call to Interpreter.Interpret does no throw any exceptions, yet I never get the InterpreterDone callback, which I use to know when the initialization is done. If I break into the debugger when it's hung, and FORCE it to think the Interpreter has completed, then all is well, and the app works as it
> > should.
> >
> > Is there anything you can think of that could cause the Interpreter to accept a G-code file without complaint, but then NOT execute it correctly, and issue the Done callback? ALL of the initialization code is identical for the first connection, and the second one, yet the second one ALWAYS fails in the manner described above. Since I'm not getting any exceptions or other error indications, I'm stumped as to how to go any further.
> >
> > Regards,
> > Ray L.
> >
>
|
|
Group: DynoMotion |
Message: 6515 |
From: Tom Kerekes |
Date: 1/18/2013 |
Subject: Re: Interpreter.Interpret |
Hi Ray,
The obvious thing would be that someplace the Token is obtained and never released.
Regards TK
Group: DynoMotion |
Message: 6516 |
From: himykabibble |
Date: 1/18/2013 |
Subject: Re: Interpreter.Interpret |
Tom,
Yup. In my code, there's only one place I ever get the token, and that's as part of a PCComm call, which can't be happening here. So, it has to be getting lost inside dotNet, perhaps when the disconnect happens? It's hanging on the line:
ok = cload_sect_data(s)
right at the end of cload_data(), called from the line:
result = !cload_headers() || !cload_symbols() || !cload_data();
in cload(); That probably doesn't help....
How can I figure out where the lock is getting lost?
Regards,
Ray L.
--- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
>
> Hi Ray,
>
> The obvious thing would be that someplace the Token is obtained and never released.
>
> Regards
> TK
>
>
>
> ________________________________
> From: himykabibble
> To: DynoMotion@yahoogroups.com
> Sent: Friday, January 18, 2013 1:06 PM
> Subject: [DynoMotion] Re: Interpreter.Interpret
>
>
> Â
> Man! I hate it when this happens! I set out to debug this, and now it's doing something different! When I try to load the Init program following a re-connect, it's hanging in a call to WaitToken, made from within KM_dotnet_Interop_CompileAndLoadCoff. What could I be doing that would cause that? It never happens on the first connect.
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> >
> > Hi Ray,
> >
> > I can't think of any.ÃÂ Obviously you can normally run multiple MDI commands without doing any special re-initialization.
> >
> > Regards
> > TKÃÂ
> >
> >
> >
> > ________________________________
> > From: himykabibble
> > To: DynoMotion@yahoogroups.com
> > Sent: Friday, January 18, 2013 10:45 AM
> > Subject: [DynoMotion] Re: Interpreter.Interpret
> >
> >
> > ÃÂ
> > Tom,
> >
> > I have the full VS2008. I'll see if I can figure out how to do that.
> >
> > Is there some initialization I should have to do after a re-connect? I do not re-create the Controller, CoordMotion or Interpreter objects, nor the KM_IO object. I just re-do my own initialization of their properties, exactly as I do on first connect.
> >
> > Regards,
> > Ray L.
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > >
> > > Hi Ray,
> > >
> > > I would just break with VS and switch to the Interpreter Thread to see where it is and what it is waiting for.ÃâàBut I'm not sure if you can do that with only the Express Version of VS.
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > >
> > > ________________________________
> > > From: himykabibble
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Thursday, January 17, 2013 10:45 PM
> > > Subject: [DynoMotion] Interpreter.Interpret
> > >
> > >
> > > ÃâÃÂ
> > > Tom,
> > >
> > > I'm down to one last bug that really has me stumped. My app starts up properly first time, every time, whether the board is connected or not. If not connected, it waits until the board is plugged in and initialized, correctly detects its presence, connects and initializes everything it needs to, and the app works properly. If the board is then unplugged, it detects this disconnect, E-Stops, and waits for it to return. When the board is again plugged in, it is again detected and initialized, *except* it hangs at the very end of the app initialization. Almost the last thing in my initialization is running an MDI line to set some default modal states. The call to Interpreter.Interpret does no throw any exceptions, yet I never get the InterpreterDone callback, which I use to know when the initialization is done. If I break into the debugger when it's hung, and FORCE it to think the Interpreter has completed, then all is well, and the app works as it
> > > should.
> > >
> > > Is there anything you can think of that could cause the Interpreter to accept a G-code file without complaint, but then NOT execute it correctly, and issue the Done callback? ALL of the initialization code is identical for the first connection, and the second one, yet the second one ALWAYS fails in the manner described above. Since I'm not getting any exceptions or other error indications, I'm stumped as to how to go any further.
> > >
> > > Regards,
> > > Ray L.
> > >
> >
>
|
|
Group: DynoMotion |
Message: 6518 |
From: Tom Kerekes |
Date: 1/18/2013 |
Subject: Re: Interpreter.Interpret |
Hi Ray,
Yeah finding the guy who can't find the token doesn't help identify the guy who stole it.
I can't think of an easy way without writing diagnostic
code. Maybe you could change all the places that call WaitToken to pass a unique wait time as a sort of ID.Then save or log the times somewhere.
Regards TK
Group: DynoMotion |
Message: 6519 |
From: himykabibble |
Date: 1/18/2013 |
Subject: Re: Interpreter.Interpret |
Tom,
Since we know the board has been disconnected and re-connected, is there any way I can force a "reset" of everything - basically a re-boot of KMotion and dotNet so they will forget there ever was a lock?
Regards,
Ray L.
--- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
>
> Hi Ray,
>
> Yeah finding the guy who can't find the token doesn't help identify the guy who stole it.
>
> I can't think of an easy way without writing diagnostic code. Maybe you could change all the places that call WaitToken to pass a unique wait time as a sort of ID.Then save or log the times somewhere.
>
> Regards
> TK
>
>
>
> ________________________________
> From: himykabibble
> To: DynoMotion@yahoogroups.com
> Sent: Friday, January 18, 2013 1:21 PM
> Subject: [DynoMotion] Re: Interpreter.Interpret
>
>
> Â
> Tom,
>
> Yup. In my code, there's only one place I ever get the token, and that's as part of a PCComm call, which can't be happening here. So, it has to be getting lost inside dotNet, perhaps when the disconnect happens? It's hanging on the line:
> ok = cload_sect_data(s)
> right at the end of cload_data(), called from the line:
>
> result = !cload_headers() || !cload_symbols() || !cload_data();
>
> in cload(); That probably doesn't help....
>
> How can I figure out where the lock is getting lost?
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> >
> > Hi Ray,
> >
> > The obvious thing would be that someplace the Token is obtained and never released.
> >
> > Regards
> > TK
> >
> >
> >
> > ________________________________
> > From: himykabibble
> > To: DynoMotion@yahoogroups.com
> > Sent: Friday, January 18, 2013 1:06 PM
> > Subject: [DynoMotion] Re: Interpreter.Interpret
> >
> >
> > ÃÂ
> > Man! I hate it when this happens! I set out to debug this, and now it's doing something different! When I try to load the Init program following a re-connect, it's hanging in a call to WaitToken, made from within KM_dotnet_Interop_CompileAndLoadCoff. What could I be doing that would cause that? It never happens on the first connect.
> >
> > Regards,
> > Ray L.
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > >
> > > Hi Ray,
> > >
> > > I can't think of any.ÃâàObviously you can normally run multiple MDI commands without doing any special re-initialization.
> > >
> > > Regards
> > > TKÃâÃÂ
> > >
> > >
> > >
> > > ________________________________
> > > From: himykabibble
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Friday, January 18, 2013 10:45 AM
> > > Subject: [DynoMotion] Re: Interpreter.Interpret
> > >
> > >
> > > ÃâÃÂ
> > > Tom,
> > >
> > > I have the full VS2008. I'll see if I can figure out how to do that.
> > >
> > > Is there some initialization I should have to do after a re-connect? I do not re-create the Controller, CoordMotion or Interpreter objects, nor the KM_IO object. I just re-do my own initialization of their properties, exactly as I do on first connect.
> > >
> > > Regards,
> > > Ray L.
> > >
> > > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > > >
> > > > Hi Ray,
> > > >
> > > > I would just break with VS and switch to the Interpreter Thread to see where it is and what it is waiting for.ÃÆ'ââ¬Å¡ÃâàBut I'm not sure if you can do that with only the Express Version of VS.
> > > >
> > > > Regards
> > > > TK
> > > >
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: himykabibble
> > > > To: DynoMotion@yahoogroups.com
> > > > Sent: Thursday, January 17, 2013 10:45 PM
> > > > Subject: [DynoMotion] Interpreter.Interpret
> > > >
> > > >
> > > > ÃÆ'ââ¬Å¡ÃâÃÂ
> > > > Tom,
> > > >
> > > > I'm down to one last bug that really has me stumped. My app starts up properly first time, every time, whether the board is connected or not. If not connected, it waits until the board is plugged in and initialized, correctly detects its presence, connects and initializes everything it needs to, and the app works properly. If the board is then unplugged, it detects this disconnect, E-Stops, and waits for it to return. When the board is again plugged in, it is again detected and initialized, *except* it hangs at the very end of the app initialization. Almost the last thing in my initialization is running an MDI line to set some default modal states. The call to Interpreter.Interpret does no throw any exceptions, yet I never get the InterpreterDone callback, which I use to know when the initialization is done. If I break into the debugger when it's hung, and FORCE it to think the Interpreter has completed, then all is well, and the app works as
> it
> > > > should.
> > > >
> > > > Is there anything you can think of that could cause the Interpreter to accept a G-code file without complaint, but then NOT execute it correctly, and issue the Done callback? ALL of the initialization code is identical for the first connection, and the second one, yet the second one ALWAYS fails in the manner described above. Since I'm not getting any exceptions or other error indications, I'm stumped as to how to go any further.
> > > >
> > > > Regards,
> > > > Ray L.
> > > >
> > >
> >
>
|
|
Group: DynoMotion |
Message: 6521 |
From: himykabibble |
Date: 1/19/2013 |
Subject: Re: Interpreter.Interpret |
Tom,
Perusing the dotNet code, I came across the method below, which seems suspect to me. Is it not possible for "action.Invoke()" to throw an exception, which would leave the lock hung?
public bool CheckConnected(params Action[] actions)
{
var result = WaitToken(100);
var conected = result != KMOTION_TOKEN.KMOTION_NOT_CONNECTED;
if (result == KMOTION_TOKEN.KMOTION_LOCKED)
{
foreach (var action in actions)
{
action.Invoke();
}
ReleaseToken();
}
return conected;
}
Regards,
Ray L.
--- In DynoMotion@yahoogroups.com, "himykabibble" wrote:
>
> Tom,
>
> Since we know the board has been disconnected and re-connected, is there any way I can force a "reset" of everything - basically a re-boot of KMotion and dotNet so they will forget there ever was a lock?
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> >
> > Hi Ray,
> >
> > Yeah finding the guy who can't find the token doesn't help identify the guy who stole it.
> >
> > I can't think of an easy way without writing diagnostic code. Maybe you could change all the places that call WaitToken to pass a unique wait time as a sort of ID.Then save or log the times somewhere.
> >
> > Regards
> > TK
> >
> >
> >
> > ________________________________
> > From: himykabibble
> > To: DynoMotion@yahoogroups.com
> > Sent: Friday, January 18, 2013 1:21 PM
> > Subject: [DynoMotion] Re: Interpreter.Interpret
> >
> >
> > Â
> > Tom,
> >
> > Yup. In my code, there's only one place I ever get the token, and that's as part of a PCComm call, which can't be happening here. So, it has to be getting lost inside dotNet, perhaps when the disconnect happens? It's hanging on the line:
> > ok = cload_sect_data(s)
> > right at the end of cload_data(), called from the line:
> >
> > result = !cload_headers() || !cload_symbols() || !cload_data();
> >
> > in cload(); That probably doesn't help....
> >
> > How can I figure out where the lock is getting lost?
> >
> > Regards,
> > Ray L.
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > >
> > > Hi Ray,
> > >
> > > The obvious thing would be that someplace the Token is obtained and never released.
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > > ________________________________
> > > From: himykabibble
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Friday, January 18, 2013 1:06 PM
> > > Subject: [DynoMotion] Re: Interpreter.Interpret
> > >
> > >
> > > ÃÂ
> > > Man! I hate it when this happens! I set out to debug this, and now it's doing something different! When I try to load the Init program following a re-connect, it's hanging in a call to WaitToken, made from within KM_dotnet_Interop_CompileAndLoadCoff. What could I be doing that would cause that? It never happens on the first connect.
> > >
> > > Regards,
> > > Ray L.
> > >
> > > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > > >
> > > > Hi Ray,
> > > >
> > > > I can't think of any.ÃâàObviously you can normally run multiple MDI commands without doing any special re-initialization.
> > > >
> > > > Regards
> > > > TKÃâÃÂ
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: himykabibble
> > > > To: DynoMotion@yahoogroups.com
> > > > Sent: Friday, January 18, 2013 10:45 AM
> > > > Subject: [DynoMotion] Re: Interpreter.Interpret
> > > >
> > > >
> > > > ÃâÃÂ
> > > > Tom,
> > > >
> > > > I have the full VS2008. I'll see if I can figure out how to do that.
> > > >
> > > > Is there some initialization I should have to do after a re-connect? I do not re-create the Controller, CoordMotion or Interpreter objects, nor the KM_IO object. I just re-do my own initialization of their properties, exactly as I do on first connect.
> > > >
> > > > Regards,
> > > > Ray L.
> > > >
> > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > > > >
> > > > > Hi Ray,
> > > > >
> > > > > I would just break with VS and switch to the Interpreter Thread to see where it is and what it is waiting for.ÃÆ'ââ¬Å¡ÃâàBut I'm not sure if you can do that with only the Express Version of VS.
> > > > >
> > > > > Regards
> > > > > TK
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > > From: himykabibble
> > > > > To: DynoMotion@yahoogroups.com
> > > > > Sent: Thursday, January 17, 2013 10:45 PM
> > > > > Subject: [DynoMotion] Interpreter.Interpret
> > > > >
> > > > >
> > > > > ÃÆ'ââ¬Å¡ÃâÃÂ
> > > > > Tom,
> > > > >
> > > > > I'm down to one last bug that really has me stumped. My app starts up properly first time, every time, whether the board is connected or not. If not connected, it waits until the board is plugged in and initialized, correctly detects its presence, connects and initializes everything it needs to, and the app works properly. If the board is then unplugged, it detects this disconnect, E-Stops, and waits for it to return. When the board is again plugged in, it is again detected and initialized, *except* it hangs at the very end of the app initialization. Almost the last thing in my initialization is running an MDI line to set some default modal states. The call to Interpreter.Interpret does no throw any exceptions, yet I never get the InterpreterDone callback, which I use to know when the initialization is done. If I break into the debugger when it's hung, and FORCE it to think the Interpreter has completed, then all is well, and the app works as
> > it
> > > > > should.
> > > > >
> > > > > Is there anything you can think of that could cause the Interpreter to accept a G-code file without complaint, but then NOT execute it correctly, and issue the Done callback? ALL of the initialization code is identical for the first connection, and the second one, yet the second one ALWAYS fails in the manner described above. Since I'm not getting any exceptions or other error indications, I'm stumped as to how to go any further.
> > > > >
> > > > > Regards,
> > > > > Ray L.
> > > > >
> > > >
> > >
> >
>
|
|
Group: DynoMotion |
Message: 6522 |
From: himykabibble |
Date: 1/19/2013 |
Subject: Re: Interpreter.Interpret |
Tom,
Also, when my app hangs, it invariably hangs in the do loop at the top of CKMotionDLL::WaitToken(). It appears to me that is intended to timeout after 2X TimeOut_ms, but TimeOut_ms is set to 1,000,000. Is that really correct? What's the point of the timeout if it's set to such a huge value? And it never seems to hit that timeout anyway. I've set breakpoints at all exits from that loop, and no breakpoint is ever hit.
Regards,
Ray L.
--- In DynoMotion@yahoogroups.com, "himykabibble" wrote:
>
> Tom,
>
> Perusing the dotNet code, I came across the method below, which seems suspect to me. Is it not possible for "action.Invoke()" to throw an exception, which would leave the lock hung?
>
> public bool CheckConnected(params Action[] actions)
> {
> var result = WaitToken(100);
> var conected = result != KMOTION_TOKEN.KMOTION_NOT_CONNECTED;
> if (result == KMOTION_TOKEN.KMOTION_LOCKED)
> {
> foreach (var action in actions)
> {
> action.Invoke();
> }
> ReleaseToken();
> }
> return conected;
> }
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, "himykabibble" wrote:
> >
> > Tom,
> >
> > Since we know the board has been disconnected and re-connected, is there any way I can force a "reset" of everything - basically a re-boot of KMotion and dotNet so they will forget there ever was a lock?
> >
> > Regards,
> > Ray L.
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > >
> > > Hi Ray,
> > >
> > > Yeah finding the guy who can't find the token doesn't help identify the guy who stole it.
> > >
> > > I can't think of an easy way without writing diagnostic code. Maybe you could change all the places that call WaitToken to pass a unique wait time as a sort of ID.Then save or log the times somewhere.
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > > ________________________________
> > > From: himykabibble
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Friday, January 18, 2013 1:21 PM
> > > Subject: [DynoMotion] Re: Interpreter.Interpret
> > >
> > >
> > > Â
> > > Tom,
> > >
> > > Yup. In my code, there's only one place I ever get the token, and that's as part of a PCComm call, which can't be happening here. So, it has to be getting lost inside dotNet, perhaps when the disconnect happens? It's hanging on the line:
> > > ok = cload_sect_data(s)
> > > right at the end of cload_data(), called from the line:
> > >
> > > result = !cload_headers() || !cload_symbols() || !cload_data();
> > >
> > > in cload(); That probably doesn't help....
> > >
> > > How can I figure out where the lock is getting lost?
> > >
> > > Regards,
> > > Ray L.
> > >
> > > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > > >
> > > > Hi Ray,
> > > >
> > > > The obvious thing would be that someplace the Token is obtained and never released.
> > > >
> > > > Regards
> > > > TK
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: himykabibble
> > > > To: DynoMotion@yahoogroups.com
> > > > Sent: Friday, January 18, 2013 1:06 PM
> > > > Subject: [DynoMotion] Re: Interpreter.Interpret
> > > >
> > > >
> > > > ÃÂ
> > > > Man! I hate it when this happens! I set out to debug this, and now it's doing something different! When I try to load the Init program following a re-connect, it's hanging in a call to WaitToken, made from within KM_dotnet_Interop_CompileAndLoadCoff. What could I be doing that would cause that? It never happens on the first connect.
> > > >
> > > > Regards,
> > > > Ray L.
> > > >
> > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > > > >
> > > > > Hi Ray,
> > > > >
> > > > > I can't think of any.ÃâàObviously you can normally run multiple MDI commands without doing any special re-initialization.
> > > > >
> > > > > Regards
> > > > > TKÃâÃÂ
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > > From: himykabibble
> > > > > To: DynoMotion@yahoogroups.com
> > > > > Sent: Friday, January 18, 2013 10:45 AM
> > > > > Subject: [DynoMotion] Re: Interpreter.Interpret
> > > > >
> > > > >
> > > > > ÃâÃÂ
> > > > > Tom,
> > > > >
> > > > > I have the full VS2008. I'll see if I can figure out how to do that.
> > > > >
> > > > > Is there some initialization I should have to do after a re-connect? I do not re-create the Controller, CoordMotion or Interpreter objects, nor the KM_IO object. I just re-do my own initialization of their properties, exactly as I do on first connect.
> > > > >
> > > > > Regards,
> > > > > Ray L.
> > > > >
> > > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > > > > >
> > > > > > Hi Ray,
> > > > > >
> > > > > > I would just break with VS and switch to the Interpreter Thread to see where it is and what it is waiting for.ÃÆ'ââ¬Å¡ÃâàBut I'm not sure if you can do that with only the Express Version of VS.
> > > > > >
> > > > > > Regards
> > > > > > TK
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > ________________________________
> > > > > > From: himykabibble
> > > > > > To: DynoMotion@yahoogroups.com
> > > > > > Sent: Thursday, January 17, 2013 10:45 PM
> > > > > > Subject: [DynoMotion] Interpreter.Interpret
> > > > > >
> > > > > >
> > > > > > ÃÆ'ââ¬Å¡ÃâÃÂ
> > > > > > Tom,
> > > > > >
> > > > > > I'm down to one last bug that really has me stumped. My app starts up properly first time, every time, whether the board is connected or not. If not connected, it waits until the board is plugged in and initialized, correctly detects its presence, connects and initializes everything it needs to, and the app works properly. If the board is then unplugged, it detects this disconnect, E-Stops, and waits for it to return. When the board is again plugged in, it is again detected and initialized, *except* it hangs at the very end of the app initialization. Almost the last thing in my initialization is running an MDI line to set some default modal states. The call to Interpreter.Interpret does no throw any exceptions, yet I never get the InterpreterDone callback, which I use to know when the initialization is done. If I break into the debugger when it's hung, and FORCE it to think the Interpreter has completed, then all is well, and the app works as
> > > it
> > > > > > should.
> > > > > >
> > > > > > Is there anything you can think of that could cause the Interpreter to accept a G-code file without complaint, but then NOT execute it correctly, and issue the Done callback? ALL of the initialization code is identical for the first connection, and the second one, yet the second one ALWAYS fails in the manner described above. Since I'm not getting any exceptions or other error indications, I'm stumped as to how to go any further.
> > > > > >
> > > > > > Regards,
> > > > > > Ray L.
> > > > > >
> > > > >
> > > >
> > >
> >
>
|
|
Group: DynoMotion |
Message: 6524 |
From: Tom Kerekes |
Date: 1/19/2013 |
Subject: Re: Interpreter.Interpret |
Hi Ray,
I believe so. However if the action caught the exception it should be ok. Or if you otherwise made sure it was later released.
I don't see
the usefulness of this function. Are you using this? I've already recommended my suggested method for doing all this.
Regards TK
Group: DynoMotion |
Message: 6525 |
From: Tom Kerekes |
Date: 1/19/2013 |
Subject: Re: Interpreter.Interpret |
Hi Ray,
In the majority of the cases it is absolutely necessary to obtain the Token before doing things. For example a WriteLineReadLine sending a ReadBit46 MUST be guaranteed to get the associated response. So the default behavior of WaitToken is to wait forever. A small timeout is not necessary to properly handle errors or USB disconnects. Those will return instantly with an error condition anyway. The only reasonable use of a timeout is in something non-critical
like a status screen update where if it is found difficult to get access you may decide just to skip it for now. For everything else you must simply get in line and wait until it is your turn. You will be guaranteed to eventually get access as long as there is no bug where someone never releases the Token.
HTH TK
Group: DynoMotion |
Message: 6527 |
From: himykabibble |
Date: 1/19/2013 |
Subject: Re: Interpreter.Interpret |
Tom,
No, I am not using this, but just came across it when looking through the code, and it struck me as possibly wrong.
Regards,
Ray L.
--- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
>
> Hi Ray,
>
> I believe so. However if the action caught the exception it should be ok. Or if you otherwise made sure it was later released.
>
> I don't see the usefulness of this function. Are you using this? I've already recommended my suggested method for doing all this.
>
>
> Regards
> TK
>
>
>
> ________________________________
> From: himykabibble
> To: DynoMotion@yahoogroups.com
> Sent: Saturday, January 19, 2013 8:30 AM
> Subject: [DynoMotion] Re: Interpreter.Interpret
>
>
> Â
> Tom,
>
> Perusing the dotNet code, I came across the method below, which seems suspect to me. Is it not possible for "action.Invoke()" to throw an exception, which would leave the lock hung?
>
> public bool CheckConnected(params Action[] actions)
> {
> var result = WaitToken(100);
> var conected = result != KMOTION_TOKEN.KMOTION_NOT_CONNECTED;
> if (result == KMOTION_TOKEN.KMOTION_LOCKED)
> {
> foreach (var action in actions)
> {
> action.Invoke();
> }
> ReleaseToken();
> }
> return conected;
> }
>
> Regards,
> Ray L.
>
> --- In DynoMotion@yahoogroups.com, "himykabibble" wrote:
> >
> > Tom,
> >
> > Since we know the board has been disconnected and re-connected, is there any way I can force a "reset" of everything - basically a re-boot of KMotion and dotNet so they will forget there ever was a lock?
> >
> > Regards,
> > Ray L.
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > >
> > > Hi Ray,
> > >
> > > Yeah finding the guy who can't find the token doesn't help identify the guy who stole it.
> > >
> > > I can't think of an easy way without writing diagnostic code.ÃÂ Maybe you could change all the places that call WaitToken to pass a unique wait time as a sort of ID.Then save or log the times somewhere.
> > >
> > > Regards
> > > TK
> > >
> > >
> > >
> > > ________________________________
> > > From: himykabibble
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Friday, January 18, 2013 1:21 PM
> > > Subject: [DynoMotion] Re: Interpreter.Interpret
> > >
> > >
> > > ÃÂ
> > > Tom,
> > >
> > > Yup. In my code, there's only one place I ever get the token, and that's as part of a PCComm call, which can't be happening here. So, it has to be getting lost inside dotNet, perhaps when the disconnect happens? It's hanging on the line:
> > > ok = cload_sect_data(s)
> > > right at the end of cload_data(), called from the line:
> > >
> > > result = !cload_headers() || !cload_symbols() || !cload_data();
> > >
> > > in cload(); That probably doesn't help....
> > >
> > > How can I figure out where the lock is getting lost?
> > >
> > > Regards,
> > > Ray L.
> > >
> > > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > > >
> > > > Hi Ray,
> > > >
> > > > The obvious thing would be that someplace the Token is obtained and never released.
> > > >
> > > > Regards
> > > > TK
> > > >
> > > >
> > > >
> > > > ________________________________
> > > > From: himykabibble
> > > > To: DynoMotion@yahoogroups.com
> > > > Sent: Friday, January 18, 2013 1:06 PM
> > > > Subject: [DynoMotion] Re: Interpreter.Interpret
> > > >
> > > >
> > > > ÃâÃÂ
> > > > Man! I hate it when this happens! I set out to debug this, and now it's doing something different! When I try to load the Init program following a re-connect, it's hanging in a call to WaitToken, made from within KM_dotnet_Interop_CompileAndLoadCoff. What could I be doing that would cause that? It never happens on the first connect.
> > > >
> > > > Regards,
> > > > Ray L.
> > > >
> > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > > > >
> > > > > Hi Ray,
> > > > >
> > > > > I can't think of any.ÃÆ'ââ¬Å¡ÃâàObviously you can normally run multiple MDI commands without doing any special re-initialization.
> > > > >
> > > > > Regards
> > > > > TKÃÆ'ââ¬Å¡ÃâÃÂ
> > > > >
> > > > >
> > > > >
> > > > > ________________________________
> > > > > From: himykabibble
> > > > > To: DynoMotion@yahoogroups.com
> > > > > Sent: Friday, January 18, 2013 10:45 AM
> > > > > Subject: [DynoMotion] Re: Interpreter.Interpret
> > > > >
> > > > >
> > > > > ÃÆ'ââ¬Å¡ÃâÃÂ
> > > > > Tom,
> > > > >
> > > > > I have the full VS2008. I'll see if I can figure out how to do that.
> > > > >
> > > > > Is there some initialization I should have to do after a re-connect? I do not re-create the Controller, CoordMotion or Interpreter objects, nor the KM_IO object. I just re-do my own initialization of their properties, exactly as I do on first connect.
> > > > >
> > > > > Regards,
> > > > > Ray L.
> > > > >
> > > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote:
> > > > > >
> > > > > > Hi Ray,
> > > > > >
> > > > > > I would just break with VS and switch to the Interpreter Thread to see where it is and what it is waiting for.ÃÆ'Ã'âââ¬Ã
¡ÃÆ'ââ¬Å¡ÃâàBut I'm not sure if you can do that with only the Express Version of VS.
> > > > > >
> > > > > > Regards
> > > > > > TK
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > ________________________________
> > > > > > From: himykabibble
> > > > > > To: DynoMotion@yahoogroups.com
> > > > > > Sent: Thursday, January 17, 2013 10:45 PM
> > > > > > Subject: [DynoMotion] Interpreter.Interpret
> > > > > >
> > > > > >
> > > > > > ÃÆ'Ã'âââ¬Ã
¡ÃÆ'ââ¬Å¡ÃâÃÂ
> > > > > > Tom,
> > > > > >
> > > > > > I'm down to one last bug that really has me stumped. My app starts up properly first time, every time, whether the board is connected or not. If not connected, it waits until the board is plugged in and initialized, correctly detects its presence, connects and initializes everything it needs to, and the app works properly. If the board is then unplugged, it detects this disconnect, E-Stops, and waits for it to return. When the board is again plugged in, it is again detected and initialized, *except* it hangs at the very end of the app initialization. Almost the last thing in my initialization is running an MDI line to set some default modal states. The call to Interpreter.Interpret does no throw any exceptions, yet I never get the InterpreterDone callback, which I use to know when the initialization is done. If I break into the debugger when it's hung, and FORCE it to think the Interpreter has completed, then all is well, and the app
> works as
> > > it
> > > > > > should.
> > > > > >
> > > > > > Is there anything you can think of that could cause the Interpreter to accept a G-code file without complaint, but then NOT execute it correctly, and issue the Done callback? ALL of the initialization code is identical for the first connection, and the second one, yet the second one ALWAYS fails in the manner described above. Since I'm not getting any exceptions or other error indications, I'm stumped as to how to go any further.
> > > > > >
> > > > > > Regards,
> > > > > > Ray L.
> > > > > >
> > > > >
> > > >
> > >
> >
>
|
|
Group: DynoMotion |
Message: 6529 |
From: Brad Murry |
Date: 1/19/2013 |
Subject: Re: Interpreter.Interpret |
I put that in as a generic function that you could execute actions while a single token was held. The thought was being able to perform an arbitrary set of actions without multiple locks. The method calling this method(i.e. in the custom app) should handle the exception, not this method itself. Exception code in a given action could handle it, but I think keeping it in the caller prevents the need from implementing exception logic in every action.(although I’m sure there are some good use cases for that in the event you wanted/needed to handle it differently per action) -Brad Murry From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On Behalf Of Tom Kerekes Sent: Saturday, January 19, 2013 3:05 PM To: DynoMotion@yahoogroups.com Subject: Re: [DynoMotion] Re: Interpreter.Interpret I believe so. However if the action caught the exception it should be ok. Or if you otherwise made sure it was later released. I don't see the usefulness of this function. Are you using this? I've already recommended my suggested method for doing all this. Tom,
Perusing the dotNet code, I came across the method below, which seems suspect to me. Is it not possible for "action.Invoke()" to throw an exception, which would leave the lock hung?
public bool CheckConnected(params Action[] actions) { var result = WaitToken(100); var conected = result != KMOTION_TOKEN.KMOTION_NOT_CONNECTED; if (result == KMOTION_TOKEN.KMOTION_LOCKED) { foreach (var action in actions) { action.Invoke(); } ReleaseToken(); } return conected; }
Regards, Ray L.
--- In DynoMotion@yahoogroups.com, "himykabibble" wrote: > > Tom, > > Since we know the board has been disconnected and re-connected, is there any way I can force a "reset" of everything - basically a re-boot of KMotion and dotNet so they will forget there ever was a lock? > > Regards, > Ray L. > > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote: > > > > Hi Ray, > > > > Yeah finding the guy who can't find the token doesn't help identify the guy who stole it. > > > > I can't think of an easy way without writing diagnostic code. Maybe you could change all the places that call WaitToken to pass a unique wait time as a sort of ID.Then save or log the times somewhere. > > > > Regards > > TK > > > > > > > > ________________________________ > > From: himykabibble > > To: DynoMotion@yahoogroups.com > > Sent: Friday, January 18, 2013 1:21 PM > > Subject: [DynoMotion] Re: Interpreter.Interpret > > > > > >  > > Tom, > > > > Yup. In my code, there's only one place I ever get the token, and that's as part of a PCComm call, which can't be happening here. So, it has to be getting lost inside dotNet, perhaps when the disconnect happens? It's hanging on the line: > > ok = cload_sect_data(s) > > right at the end of cload_data(), called from the line: > > > > result = !cload_headers() || !cload_symbols() || !cload_data(); > > > > in cload(); That probably doesn't help.... > > > > How can I figure out where the lock is getting lost? > > > > Regards, > > Ray L. > > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote: > > > > > > Hi Ray, > > > > > > The obvious thing would be that someplace the Token is obtained and never released. > > > > > > Regards > > > TK > > > > > > > > > > > > ________________________________ > > > From: himykabibble > > > To: DynoMotion@yahoogroups.com > > > Sent: Friday, January 18, 2013 1:06 PM > > > Subject: [DynoMotion] Re: Interpreter.Interpret > > > > > > > > >  > > > Man! I hate it when this happens! I set out to debug this, and now it's doing something different! When I try to load the Init program following a re-connect, it's hanging in a call to WaitToken, made from within KM_dotnet_Interop_CompileAndLoadCoff. What could I be doing that would cause that? It never happens on the first connect. > > > > > > Regards, > > > Ray L. > > > > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote: > > > > > > > > Hi Ray, > > > > > > > > I can't think of any. Obviously you can normally run multiple MDI commands without doing any special re-initialization. > > > > > > > > Regards > > > > TK > > > > > > > > > > > > > > > > ________________________________ > > > > From: himykabibble > > > > To: DynoMotion@yahoogroups.com > > > > Sent: Friday, January 18, 2013 10:45 AM > > > > Subject: [DynoMotion] Re: Interpreter.Interpret > > > > > > > > > > > >  > > > > Tom, > > > > > > > > I have the full VS2008. I'll see if I can figure out how to do that. > > > > > > > > Is there some initialization I should have to do after a re-connect? I do not re-create the Controller, CoordMotion or Interpreter objects, nor the KM_IO object. I just re-do my own initialization of their properties, exactly as I do on first connect. > > > > > > > > Regards, > > > > Ray L. > > > > > > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes wrote: > > > > > > > > > > Hi Ray, > > > > > > > > > > I would just break with VS and switch to the Interpreter Thread to see where it is and what it is waiting for.ÃÆ'‚ But I'm not sure if you can do that with only the Express Version of VS. > > > > > > > > > > Regards > > > > > TK > > > > > > > > > > > > > > > > > > > > > > > > > ________________________________ > > > > > From: himykabibble > > > > > To: DynoMotion@yahoogroups.com > > > > > Sent: Thursday, January 17, 2013 10:45 PM > > > > > Subject: [DynoMotion] Interpreter.Interpret > > > > > > > > > > > > > > > ÃÆ'‚ > > > > > Tom, > > > > > > > > > > I'm down to one last bug that really has me stumped. My app starts up properly first time, every time, whether the board is connected or not. If not connected, it waits until the board is plugged in and initialized, correctly detects its presence, connects and initializes everything it needs to, and the app works properly. If the board is then unplugged, it detects this disconnect, E-Stops, and waits for it to return. When the board is again plugged in, it is again detected and initialized, *except* it hangs at the very end of the app initialization. Almost the last thing in my initialization is running an MDI line to set some default modal states. The call to Interpreter.Interpret does no throw any exceptions, yet I never get the InterpreterDone callback, which I use to know when the initialization is done. If I break into the debugger when it's hung, and FORCE it to think the Interpreter has completed, then all is well, and the app works as > > it > > > > > should. > > > > > > > > > > Is there anything you can think of that could cause the Interpreter to accept a G-code file without complaint, but then NOT execute it correctly, and issue the Done callback? ALL of the initialization code is identical for the first connection, and the second one, yet the second one ALWAYS fails in the manner described above. Since I'm not getting any exceptions or other error indications, I'm stumped as to how to go any further. > > > > > > > > > > Regards, > > > > > Ray L. > > > > > > > > > > > > > > >
|
|
| | | | | | | | | | | |