How to clear "error Previous request not completed" ?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

charlesBUSd8qF
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 39
Joined: Wed Apr 11, 2012 10:28 pm

Re: How to clear "error Previous request not completed" ?

Post by charlesBUSd8qF » Tue Nov 14, 2017 11:17 am

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

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: How to clear "error Previous request not completed" ?

Post by simon.schvartzman » Tue Nov 14, 2017 12:02 pm

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
Simon
________________________________________
To ";" or not to ";" that is the question

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to clear "error Previous request not completed" ?

Post by jacque » Wed Nov 15, 2017 7:49 am

@Charles, I'm confused about the second parameter here:

Code: Select all

tsNetSetTimeouts 30, 0, 300000, 60000, 30, 1000
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?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

charlesBUSd8qF
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 39
Joined: Wed Apr 11, 2012 10:28 pm

Re: How to clear "error Previous request not completed" ?

Post by charlesBUSd8qF » Wed Nov 15, 2017 10:37 am

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to clear "error Previous request not completed" ?

Post by jacque » Wed Nov 15, 2017 4:56 pm

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

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: How to clear "error Previous request not completed" ?

Post by simon.schvartzman » Wed Nov 15, 2017 6:40 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to clear "error Previous request not completed" ?

Post by jacque » Wed Nov 15, 2017 8:22 pm

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. :)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: How to clear "error Previous request not completed" ?

Post by bogs » Thu Nov 16, 2017 1:45 am

jacque wrote:
Wed Nov 15, 2017 8:22 pm
actually I've taken a small detour in the discussion...
I don't think thats ever happened before, without my personal help... :shock:
So I'm taking advantage of him...
In this case, it is for a good cause. <sits on the side, watching>
Image

charlesBUSd8qF
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 39
Joined: Wed Apr 11, 2012 10:28 pm

Re: How to clear "error Previous request not completed" ?

Post by charlesBUSd8qF » Thu Nov 16, 2017 11:28 am

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to clear "error Previous request not completed" ?

Post by jacque » Thu Nov 16, 2017 4:53 pm

charlesBUSd8qF wrote:
Thu Nov 16, 2017 11:28 am
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).
LOL. Thanks Charles. Of course, no one else has ever done that. :-)

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

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: How to clear "error Previous request not completed" ?

Post by simon.schvartzman » Fri Nov 17, 2017 9:00 pm

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
Simon
________________________________________
To ";" or not to ";" that is the question

simon.schvartzman
Posts: 638
Joined: Tue Jul 29, 2014 12:52 am
Location: Brazil

Re: How to clear "error Previous request not completed" ?

Post by simon.schvartzman » Mon Nov 27, 2017 10:11 pm

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

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
Many thanks to all that helped, specially to Charles.

Regards
Simon
________________________________________
To ";" or not to ";" that is the question

Post Reply

Return to “Talking LiveCode”