RTC Forums
May 05, 2024, 07:15:58 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: C++ XE4 and HttpServer - occasional AVs quitting application  (Read 3341 times)
Claudio
Newbie
*
Posts: 8


« 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
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 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.

Best Regards,
Danijel Tkalcec
Logged
Claudio
Newbie
*
Posts: 8


« Reply #2 on: September 23, 2013, 06:59:12 AM »

Whoops... My bad, sorry.

Thanks for the code snippets.

Claudio
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 16 queries.