RTC Forums

Subscription => Support => Topic started by: Claudio on September 22, 2013, 01:45:22 PM



Title: C++ XE4 and HttpServer - occasional AVs quitting application
Post by: Claudio on September 22, 2013, 01:45:22 PM
Hi again,

try this:

- drop an HttpServer on a form and set its port to, say, 80
- set Multithreaded = true
- run the application from the IDE for 5 or 10 secs and quit: two or three AVs (may not happen always)
- set Multithreaded = false
- run the application from the IDE for 5 or 10 secs and quit: no AVs at all

All these steps performed without invoking the server from a browser. If you do it, AVs quitting the application are guaranteed to happen.
Seems the multithreading here is the culprit. If you run from the OS, these AVs never happen (or, better, you probably don't see them).

Thank You

Claudio


Title: Re: C++ XE4 and HttpServer - occasional AVs quitting application
Post by: D.Tkalcec (RTC) on September 22, 2013, 03:49:33 PM
You need to call StopListenNow on all HttpServer components before any component is destroyed. If you don't, there wil be background threads which are still using the components *after* they are destroyed. That will cause AVs at shutdown.

See this FAQ topic (https://rtcforum.teppi.net/index.php?topic=95.0).

Best Regards,
Danijel Tkalcec


Title: Re: C++ XE4 and HttpServer - occasional AVs quitting application
Post by: Claudio on September 23, 2013, 06:59:12 AM
Whoops... My bad, sorry.

Thanks for the code snippets.

Claudio