HandleURL event timeout

Hey everyone. I need your help with something I don’t understand.

I have a WebApp I use exclusively as an API using the HandleURL event. I noticed something odd with POST requests. If the POST has content in the body, and the process takes longer than about 30 seconds, the client gets disconnected without receiving an answer. I can see in debug that the process continues in the app and eventually ends correctly, returning the page which the disconnected client obviously never receives.

If the POST has an empty body, it does not “timeout” and the client gets the answer.

To test it, I have setup a very simple WebApp with only the following code in the HandleURL event:

// only handle if the URL path is "test"
if Request.path <> "test" then return False

// simulate some long process

for i as integer = 1 to 50
  // sleep for 1 second

response.status = 200

return true

I test the api using RapidAPI (formerly PAW)

  • with an empty body: I receive a status 200 page with “ok” after about 50 seconds (as expected).
  • with even a single character in the body, I get disconnected (time varies) and RapidAPI shows “Socket closed by remote peer” and no data is received.

If I reduce the processing time by reducing the loop from 1 to 20, then I don’t get disconnected and everything works, with or without a body content.

This is in Xojo 2023r1.1 MacOS

ps: I know that the app could (and maybe should) be designed to grab the data, send a response and complete the lengthy process in a helper app / other thread.

Hi @Bruno_Frechette.

I just tested this with Xojo 2023r3, and I’m not seeing the behavior that you described. So maybe there’s a difference between 2023r1.1 and 2023r3.

If you pause the app when it’s in the loop, does the request body have the value that you sent?

Can you download the latest Xojo to test?

If the content is > 256K it will be spoiled to disk. Is it possible that you’re running out of disk space?

Thanks for the answers.
@Tim_Dietrich Yes the request body contains what was sent. I’ll download the latest Xojo and test.
@Greg_O I see this behaviour with even a single character in the body.
I’ll post the results with 2023r3 this morning.

This means nothing !

Sometimes ago, I was on the moon, my running external HD was full and I did not understand why my 32KB html file was not generated ! After some times (around one hour + a TV Show), I noticed the full external HD.

:slight_smile: Yes you’re right. I forgot to answer to Greg’s question. There’s over 200 gigs available on my hd so there’s plenty of space available.

So I downloaded and ran 2023r3.1 and the same small test app … runs perfectly. That was an easy fix :slight_smile: Thanks all for your time.

1 Like

There was a bug starting in 2022r3 that I discussed privately with @Ricardo_Cruz because I have lost all faith in the ticket system. He’s told me that it will be fixed in 2023r4. Try the pre-release if it’s available, I do not have access to them.

Yes, 2023r4 will come with a fix for those API requests that are taking more than a few seconds to prepare the response. Please give it a try if it keeps happening, it also comes with interesting performance improvements.

1 Like

I thought the thread origin stated you were using 2023r3.1 at the time, and had this issue? Which version failed and which version works for you now?


1 Like