Stack hangs on open
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 31
- Joined: Mon Apr 27, 2015 3:09 pm
Stack hangs on open
Can you tell me the steps necessary to debug/launch a broken livecode stack? Twice in the last week this has happened to me: I am working on my project, I close it out and try to get back into it and it won't open, I just get a "wait indicator" spinning wheel and I have to force quit livecode. Nothing is wrong with the stack as far as I know, it was working fine right before I closed it.
In the on preOpenStack, i am running "start using stack xxx.livecode" with 3 other "library" stacks, (web service, core functions, etc.) If I comment out those lines, it still won't open. However, if I remove the files totally from the directory where they are to reside, the main stack will open and of course fail on those lines, but if I just step through it the stack opens fine.
This happens way to easily in my opinion. Even if I have a bug, it should open and tell me what the problem is, right?
How do I figure out what's going on?
In the on preOpenStack, i am running "start using stack xxx.livecode" with 3 other "library" stacks, (web service, core functions, etc.) If I comment out those lines, it still won't open. However, if I remove the files totally from the directory where they are to reside, the main stack will open and of course fail on those lines, but if I just step through it the stack opens fine.
This happens way to easily in my opinion. Even if I have a bug, it should open and tell me what the problem is, right?
How do I figure out what's going on?
-
- Posts: 31
- Joined: Mon Apr 27, 2015 3:09 pm
Re: Stack hangs on open
By the way, I'm using Mac for development and I'm using version 6.0.5. I did download livecode on my Windows PC and transfered the project over there and it does the same thing. When it happened last week, I was able to get it to work eventually by opening it in Windows, but I'm not exactly sure what I did and this time it doesn't seem to work.
-
- Posts: 31
- Joined: Mon Apr 27, 2015 3:09 pm
Re: Stack hangs on open
Also, possibly I am shutting things down wrong or something. I'm not exactly sure of the best way to run a stack from the beginning if it's already open.
-
- Posts: 31
- Joined: Mon Apr 27, 2015 3:09 pm
Re: Stack hangs on open
OK, starting to understand how this thing works. It looks like when you open a stack, before it starts the stack script it must inspect all of the controls, or initialize them. I have a control that must have some content in it that livecode doesn't like and it hangs there. I can't debug through it to see where it's happening because it's happening before the script even runs.
Does that make sense? Am I right about that?
So, if I comment out where it opens that substack that contains the control that has the bad content in it, it runs. Later on in the script that content gets wiped out, so if I uncomment the substack open, the next time I run the stack it works just fine.
Is this how the process works? Is there a way to avoid this problem, or at least track in down? I can wipe out the content of this control in on closeStack, but what if the same thing happens with another control? How can I track it down?
Plus, why does it hang up on certain content?
Does that make sense? Am I right about that?
So, if I comment out where it opens that substack that contains the control that has the bad content in it, it runs. Later on in the script that content gets wiped out, so if I uncomment the substack open, the next time I run the stack it works just fine.
Is this how the process works? Is there a way to avoid this problem, or at least track in down? I can wipe out the content of this control in on closeStack, but what if the same thing happens with another control? How can I track it down?
Plus, why does it hang up on certain content?
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Stack hangs on open
Hi matthellstrom,
Just so you don't think you are talking to the air;
Simon
Just so you don't think you are talking to the air;
When this happens to me I just put a "wait 1 (some time) with messages" in, it has to do with the engine getting clogged up and a "wait" gives it time to catch up. The stepping through is slow so it does finish processing stuff before it moves on to the next thing. You might have to drop a couple of them around....but if I just step through it the stack opens fine.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Stack hangs on open
I can't say whether this is anything remotely connected, but is the "dodgy" content in a field? Even a hidden field?
If so, fields should only ever have "visible" content (content that should/could be viewed) and never be used for holding binary or non-text-formatted data. The engine will try to render a view of the field content even off screen, and if it encounters non-renderable data it will struggle. Use a custom property to hold non-renderable data, not a field.
If that's what is happening.
If so, fields should only ever have "visible" content (content that should/could be viewed) and never be used for holding binary or non-text-formatted data. The engine will try to render a view of the field content even off screen, and if it encounters non-renderable data it will struggle. Use a custom property to hold non-renderable data, not a field.
If that's what is happening.
-
- Posts: 31
- Joined: Mon Apr 27, 2015 3:09 pm
Re: Stack hangs on open
It sounds like that's what may be happening. It is in a field. It's a debug window, that displays data that comes from my web calls, so I guess there could be binary data in there from time to time. Maybe I just turn it off when I don't need it. There isn't a way to display a custom property in a window, is there? Would probably be the same problem though.SparkOut wrote:I can't say whether this is anything remotely connected, but is the "dodgy" content in a field? Even a hidden field?
If so, fields should only ever have "visible" content (content that should/could be viewed) and never be used for holding binary or non-text-formatted data. The engine will try to render a view of the field content even off screen, and if it encounters non-renderable data it will struggle. Use a custom property to hold non-renderable data, not a field.
If that's what is happening.
Re: Stack hangs on open
Run Live code and before you open the stack, go to the Development Menu and click "Suppress Messages", then open your stack. That won't fix whatever is causing the problem but it will open the stack without sending any of the normal LC messages (preOpenCard, preOpenStack, etc) so you can check your code and fix whatever is causing the problem.
Pete
Pete
-
- Posts: 31
- Joined: Mon Apr 27, 2015 3:09 pm
Re: Stack hangs on open
OK great! Thanks!
Re: Stack hangs on open
Oh yes, don't forget to disable "Suppress Messages" when you're ready to open the stack again!
Another thing you might find useful if you don't already know about it. If you right click anywhere on your stack when it's open and you're in Edit mode, at the bottom of the popup menu, you'll see options to send messages to the card or stack and clicking on one of those shows a list of the message handlers available. Selecting one of them sends the message which can be useful and quicker than closing the stack and re-opening it of you are trying to test preOpenxxx or openxxx message handlers.
The above might help you track down what is causing your problem. Open the stack while messages are suppressed, then disable "Suppress "Messages". Then open the stack/card script you think is causing the problem and set a breakpoint where you think the problem is occurring. Now use the right click method to send the message to the handler where you set the breakpoint.
HTH,
Pete
Another thing you might find useful if you don't already know about it. If you right click anywhere on your stack when it's open and you're in Edit mode, at the bottom of the popup menu, you'll see options to send messages to the card or stack and clicking on one of those shows a list of the message handlers available. Selecting one of them sends the message which can be useful and quicker than closing the stack and re-opening it of you are trying to test preOpenxxx or openxxx message handlers.
The above might help you track down what is causing your problem. Open the stack while messages are suppressed, then disable "Suppress "Messages". Then open the stack/card script you think is causing the problem and set a breakpoint where you think the problem is occurring. Now use the right click method to send the message to the handler where you set the breakpoint.
HTH,
Pete
-
- Posts: 31
- Joined: Mon Apr 27, 2015 3:09 pm
Re: Stack hangs on open
OK thanks for the help. It's hard to know how to do things best.