<div dir="ltr">Dear Developers,<br><br>We're currently having an issue with MapServer and I am hoping you can give some idea how to work around this. <br><br>We use <a href="http://asp.net">asp.net</a> and IIS, where the web requests are being served from a pool of threads within a single process. The application runs fine if we just use it manually, but when we run a load test which involves 20 concurrent users or so, the worker process CPU gets stuck at 25% after a while (there are 4 virtual cpu on this box, so it looks like it is maxing one of the vCPU). Every subsequent requests on that particular worker process times out. <br><br>The test consists of loading a map, doing a selection (ie queryBypoint) and generate a map, then move to another area in a grid like pattern and do another selection and map export.<br>Once finished the test starts again automatically, load the map, selection, etc... for each concurrent user. The test complete successfully a few iterations but after a while the CPU gets stuck.<br>Note that the same request executed successfully many times before.<br><br>After the process was getting stucked this way, we took a memory snapshot with some debugging information which shows the following results:<br><br>1.  One of the threads is operating in an endless loop in maplexer.c inside the following fragment:<br><br><i>do<br>{<br>YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;<br>if ( yy_accept[yy_current_state] )<br>{<br>(yy_last_accepting_state) = yy_current_state;<br>(yy_last_accepting_cpos) = yy_cp;<br>}<br>while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )<br>{<br>yy_current_state = (int) yy_def[yy_current_state];<br>if ( yy_current_state >= 2034 )<br>yy_c = yy_meta[yy_c];<br>}<br>yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];<br>++yy_cp;<br>}<br>while ( yy_current_state != 2033 );</i><br><br>It looks like yy_current_state never gets the expected value to get out of the loop, but it is not too trivial for me how to interpret this situation in the lexer generated code. It may probably be a bug in the lexer itself or we didn't manage to protect the static variables against the multiple thread access well enough (?)<br><br>2. I can also see in the memory dmp that more than 75% of the threads are waiting for the parser lock at msLoadMapFromString which significantly degrades the performance by consuming the available threads from the pool. Do we have any ongoing effort to make the mapfile/expression lexer/parser reentrant?<br><br>The application is using a 7.4.x version of MapServer and it doesn't seem to be trivial for us to upgrade in short term, but if you can confirm this specific problem has already been addressed in a later version we'll consider to upgrade.<br><br>Thanks,<br><br>Tamas<br><br><br><br></div>