How to clear "error Previous request not completed" ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 39
- Joined: Wed Apr 11, 2012 10:28 pm
Re: How to clear "error Previous request not completed" ?
Hi Simon,
Sorry, I should have clarified myself about the resetAll command.
What I meant is that if your callback function is getting executed with the pHttpResponseCode variable containing something other than 200, than your application is unlikely to have hit a "lock up" situation where a resetAll needs to be issued.
If the network connection has locked up to a point that a call to resetAll is needed to fix it, then I would expect that your callback function isn't getting invoked at all - therefore not getting to the line of code where the call to resetAll is.
However, as mentioned previously, I think the tsNetSetTimeouts function is key to resolving your issue - and the resetAll call should not be needed at all.
From the error message you are getting, it appears to be stalling on the actual call to tsNetSetTimeouts.
Try change that call to:
tsNetSetTimeouts 30, 0, 300000, 60000, 30, 1000
And let me know how it goes.
Regards,
Charles
Sorry, I should have clarified myself about the resetAll command.
What I meant is that if your callback function is getting executed with the pHttpResponseCode variable containing something other than 200, than your application is unlikely to have hit a "lock up" situation where a resetAll needs to be issued.
If the network connection has locked up to a point that a call to resetAll is needed to fix it, then I would expect that your callback function isn't getting invoked at all - therefore not getting to the line of code where the call to resetAll is.
However, as mentioned previously, I think the tsNetSetTimeouts function is key to resolving your issue - and the resetAll call should not be needed at all.
From the error message you are getting, it appears to be stalling on the actual call to tsNetSetTimeouts.
Try change that call to:
tsNetSetTimeouts 30, 0, 300000, 60000, 30, 1000
And let me know how it goes.
Regards,
Charles
-
- Posts: 641
- Joined: Tue Jul 29, 2014 12:52 am
- Location: Brazil
Re: How to clear "error Previous request not completed" ?
Charlie, many thanks for your prompt reply.
Understood the explanation about resetAll, makes sense.
Good news, changing to:
tsNetSetTimeouts 30, 0, 300000, 60000, 30, 1000
did the trick, working now both on the IDE and simulator.
Will update my App and place into production.
Will consider as fixed if it works for 7 days uninterrupted (never was able to have it running for 5 days).
Regards
Understood the explanation about resetAll, makes sense.
Good news, changing to:
tsNetSetTimeouts 30, 0, 300000, 60000, 30, 1000
did the trick, working now both on the IDE and simulator.
Will update my App and place into production.
Will consider as fixed if it works for 7 days uninterrupted (never was able to have it running for 5 days).
Regards
Simon
________________________________________
To ";" or not to ";" that is the question
________________________________________
To ";" or not to ";" that is the question
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: How to clear "error Previous request not completed" ?
@Charles, I'm confused about the second parameter here:
The dictionary says this controls the maximum time a request can take. Does a zero mean the maximum time is no milliseconds at all? In other words, the request will time out immediately?
If so, then is the connection closed or aborted? What happens when the second param is zero?
Code: Select all
tsNetSetTimeouts 30, 0, 300000, 60000, 30, 1000
If so, then is the connection closed or aborted? What happens when the second param is zero?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 39
- Joined: Wed Apr 11, 2012 10:28 pm
Re: How to clear "error Previous request not completed" ?
Hi Jacque,
A value of zero for the second parameter means that there is no limit on how long a request can take.
If you set this to a non-zero value, it limits the maximum total time a request can take regardless of how much data has to be transferred - which is why it is generally best to leave it as zero.
If it is set and the maximum time is reached, the transfer will be aborted.
If you are certain that none of your network requests/transfers will exceed a specific length of time in your application, then you can adjust it accordingly.
I will be updating the dictionary entry for tsNetSetTimeouts in the next release to make it clearer.
Hope that helps,
Regards,
Charles
A value of zero for the second parameter means that there is no limit on how long a request can take.
If you set this to a non-zero value, it limits the maximum total time a request can take regardless of how much data has to be transferred - which is why it is generally best to leave it as zero.
If it is set and the maximum time is reached, the transfer will be aborted.
If you are certain that none of your network requests/transfers will exceed a specific length of time in your application, then you can adjust it accordingly.
I will be updating the dictionary entry for tsNetSetTimeouts in the next release to make it clearer.
Hope that helps,
Regards,
Charles
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: How to clear "error Previous request not completed" ?
I wondered about that. What would be the difference between an empty parameter and zero? The first suggestion used an empty parameter but didn't fix the problem, adding the zero did.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 641
- Joined: Tue Jul 29, 2014 12:52 am
- Location: Brazil
Re: How to clear "error Previous request not completed" ?
Jaque in order to avoid jumping into wrong conclusions let me clarify a bit
- The Problem: App hangs when there is a poor internet connection.
- tsNetSetTimeouts 30, , 300000, 60000, 30, 1000 hangs the App no matter what (with or without connection)
- tsNetSetTimeouts 30, 0, 300000, 60000, 30, 1000 makes the App to run as expected in a controlled environment (manually dropping the connection)
- After one week, uninterruptedly running in "real life", I will be able to confirm the original problem was fixed.
Simon
________________________________________
To ";" or not to ";" that is the question
________________________________________
To ";" or not to ";" that is the question
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: How to clear "error Previous request not completed" ?
Simon, yes, but actually I've taken a small detour in the discussion, wondering what the difference is in the two versions of the second parameter. Charles is the author of the tsNet external so I'm picking his brain about the syntax.
If I understood the guts of internet connections better it might be clearer to me, but he's the expert. He's not only an invaluable resource, he's always very responsive. So I'm taking advantage of him for that.
If I understood the guts of internet connections better it might be clearer to me, but he's the expert. He's not only an invaluable resource, he's always very responsive. So I'm taking advantage of him for that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- VIP Livecode Opensource Backer
- Posts: 39
- Joined: Wed Apr 11, 2012 10:28 pm
Re: How to clear "error Previous request not completed" ?
Hi Jacque,
In this case it is really simple - the first syntax was wrong! (I had quickly copied it from the dictionary to get the default values rather than checking back in my code and didn't notice the error).
The reason Simon's app was hanging was simply that LC was hitting a runtime error on the tsNetSetTimeouts command when the second parameter was blank.
I have made a note to make sure that dictionary example is fixed in the next release.
Regards,
Charles
In this case it is really simple - the first syntax was wrong! (I had quickly copied it from the dictionary to get the default values rather than checking back in my code and didn't notice the error).
The reason Simon's app was hanging was simply that LC was hitting a runtime error on the tsNetSetTimeouts command when the second parameter was blank.
I have made a note to make sure that dictionary example is fixed in the next release.
Regards,
Charles
-
- VIP Livecode Opensource Backer
- Posts: 7237
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: How to clear "error Previous request not completed" ?
LOL. Thanks Charles. Of course, no one else has ever done that.charlesBUSd8qF wrote: ↑Thu Nov 16, 2017 11:28 amIn this case it is really simple - the first syntax was wrong! (I had quickly copied it from the dictionary to get the default values rather than checking back in my code and didn't notice the error).
It was a useful error though, I understand things better now.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 641
- Joined: Tue Jul 29, 2014 12:52 am
- Location: Brazil
Re: How to clear "error Previous request not completed" ?
Hi team, just to keep informed all of you that helped me.
This is the status so far:
1 - App run for 1 day OK
2 - Stopped responding for about 2 hours
3 - Recovered without intervention
4 - Run again for about 20 hours
5 - Didn't recovered after 6 hours
There are no logs recorded on the device.
Before reaching any conclusion I will start another test next Monday because when I got to the place where the device is installed (a building under construction) it was out of power and I have no way to discover when it was unplugged from the outlet.
BTW my iPhone is set to run in "Single App Mode" so it should recover from a power drop.
Cheers
This is the status so far:
1 - App run for 1 day OK
2 - Stopped responding for about 2 hours
3 - Recovered without intervention
4 - Run again for about 20 hours
5 - Didn't recovered after 6 hours
There are no logs recorded on the device.
Before reaching any conclusion I will start another test next Monday because when I got to the place where the device is installed (a building under construction) it was out of power and I have no way to discover when it was unplugged from the outlet.
BTW my iPhone is set to run in "Single App Mode" so it should recover from a power drop.
Cheers
Simon
________________________________________
To ";" or not to ";" that is the question
________________________________________
To ";" or not to ";" that is the question
-
- Posts: 641
- Joined: Tue Jul 29, 2014 12:52 am
- Location: Brazil
Re: How to clear "error Previous request not completed" ?
Hi all, I'm very happy to report that the one week challenge was successfully achieved !!!
The only remark is regarding the time to wait before sending a new request in the case response is not OK (<> than 200). Originally I was waiting 1 second and it seems was not good enough. When I changed to 15 seconds everything worked OK.
So the working code is
Many thanks to all that helped, specially to Charles.
Regards
The only remark is regarding the time to wait before sending a new request in the case response is not OK (<> than 200). Originally I was waiting 1 second and it seems was not good enough. When I changed to 15 seconds everything worked OK.
So the working code is
Code: Select all
// this is the code of the "Start" button
on mouseUp
set the text of field "lblStatus" to empty
-- when the following line is uncommented script hangs
-- even with good network connection
tsNetSetTimeouts 30, 0, 300000, 60000, 30, 1000
wait 1 second
dropboxDownLoad pAccessToken, "/command.txt", LoopCallBack
end mouseUp
on LoopCallback pRequestID, pHttpResponseCode, pData
-- Response = 200 means OK
set the text of field "lblStatus" to pHttpResponseCode
if (pHttpResponseCode is 200) then
set the text of field "lblStatus" to "OK"
else
set the text of field "lblStatus" to "Failure"
resetAll
end if
send "mouseUp" to button "Start" in 15 seconds
end LoopCallback
Regards
Simon
________________________________________
To ";" or not to ";" that is the question
________________________________________
To ";" or not to ";" that is the question