<div dir="ltr"><div><div>Hi,<br><br></div>mi recent experiments with multi-threaded python wrappers for QGIS server showed a critical flaw in my original implementation of the server plugins.</div><div><br></div><div>First, I want to stress that this is not a problem in FCGI server implementation but only if the server is used directly from python in a multi threaded server implementation.<br></div><div><br></div><div>The problem is that the server interface that exposes the request handler is a static property of the interface, that is changed on every request.</div><div>This means that there is a race condition in setting/accessing the handler from a plugin filter, and that a plugin filter might access to the handler for a wrong request.</div><div><br></div><div>The solution is to pass the request handler (or the request and/or response objects depending on the filter) to the plugin filters and leave the interface for static properties only.</div><div><br></div><div>This would be a big API change for the server interface and filters and I'm not sure we have time/resources to do that now.</div><div><br></div><div>As an alternative we could simply document the issue and change the testing code to create a new server instance to server every request (to be verified, and with consitent performance degradation).<br></div><div><br></div><div>What's your opinion about this issue?</div><div><br></div><div>BTW,  tomorrow I'll file a ticket for this problem.<br></div><div><div><div><div><br>-- <br><div class="gmail_signature">Alessandro Pasotti<br>w3:   <a href="http://www.itopen.it" target="_blank">www.itopen.it</a></div>
</div></div></div></div></div>