This project has moved. For the latest updates, please go here.


TIdHTTPServer errors on Linux (range violation / out of memory)


What steps will reproduce the problem?1. write and run a TIdHTTPServer on Linux2. execute concurrent HTTP GET requests What is the expected output? What do you see instead?Concurrent GET request should complete without errors.However, the server frequently fails with errors which seem to be caused by multi threading problems in TIdMBCSEncoding.GetCharCount. Debugging shows that the second call to iconv in this method often returns incorrect values in LCharsSize.What version of the product are you using? On what operating system?Indy r 4888Please provide any additional information below.I will try to implement a thread-safe version of this method (and other methods using iconv).Example log stack trace:3061644096 (1) LCharsSize=12386310 <--- should be a much smaller value (usually it is 6) warn | TdjHTTPServer (OnException): EOutOfMemory Out of memory $0806D4BA TIDTEXTENCODING__GETCHARS, line 2054 of /home/mj/indy10/Lib/System/IdGlobal.pas $0806D327 TIDTEXTENCODING__GETCHARS, line 2034 of /home/mj/indy10/Lib/System/IdGlobal.pas $0806C512 TIDTEXTENCODING__CONVERT, line 1779 of /home/mj/indy10/Lib/System/IdGlobal.pas $0810D92D TIDURI__URLDECODE, line 341 of /home/mj/indy10/Lib/Protocols/IdURI.pas $080C0F87 TIDCUSTOMHTTPSERVER__DOEXECUTE, line 1241 of /home/mj/indy10/Lib/Protocols/IdCustomHTTPServer.pas $080C5675 TIDCONTEXT__RUN, line 171 of /home/mj/indy10/Lib/Core/IdContext.pas $080EA6A4 TIDTASK__DORUN, line 111 of /home/mj/indy10/Lib/Core/IdTask.pas $080DBF54 TIDTHREADWITHTASK__RUN, line 608 of /home/mj/indy10/Lib/Core/IdThread.pas $080DB432 TIDTHREAD__EXECUTE, line 363 of /home/mj/indy10/Lib/Core/IdThread.pas $0809B136I have added debug helper code to IdGlobal to write LCharsSize and current thread id to StdOut (attached)

file attachments

Closed Apr 6 at 1:08 AM by gambit47


gambit47 wrote Dec 29, 2012 at 7:18 AM

TIdMBCSEncoding has been re-written in rev 4891 to use iconv in a more thread-safe manner.

wrote Feb 13, 2013 at 10:09 PM

wrote May 16, 2013 at 5:14 AM

wrote May 16, 2013 at 5:14 AM

wrote Jun 14, 2013 at 7:50 AM

wrote Apr 6 at 1:08 AM