<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div>Dear all,<br><br>I'm new to the Nginx project and I am just getting familiar with it. Let me first thank to the contributors for the work they've put into to make the project so nice.<br>
<br></div>I've observed very 'strange' behaviour and took me quite a lot time to find the cause for it (not to understand it yet). Let me start in the beginning:<br></div>- I've been playing with Hello world examples of course and then started to build bigger 'real' module.<br>
</div>- Suddenly I've got very unpredictable behaviour and seg. faults.<br></div>- I've stripped down my module back to real bare minimum - at the end I just included one command which sends "Hello world" string back to the client. The thing was still acting very strange: ngx_http_request_t seems 'unstable' - r->method with strange numbers, if I wanted to log in r->connection->log I've got seg. fault, ... I'm fairly sure my test module does not hot have any memory leaks because I am using only one static string which is put to the output buffer.<br>
</div>- In the end I've removed the system C includes (sys/types.h, sys/stat.h, unistd.h) and my simple example started to work again - I've tried few times to add includes, put them before Nginx includes or after - it was very repeatable and the module was stable if I either did not include or include them after Nginx module:<br>
</div><div>For example: <br></div><div><-- snip --><br></div>#include <sys/types.h><br></div>#include <sys/stat.h><br></div>#include <unistd.h><br><br></div>#include <ngx_config.h><br></div>#include <ngx_core.h><br>
</div>#include <ngx_http.h><br></div><-- snip --><br></div><br></div>Crashes my module, while:<br><div><-- snip --><br>#include <ngx_config.h><br>#include <ngx_core.h><br>#include <ngx_http.h><br>
<br></div>#include <sys/types.h><br>#include <sys/stat.h><br>#include <unistd.h><br><-- snip --><br><br></div>Seems to work.<br><br>My question: Did anybody observed this behaviour? Obviously the system includes can influence/change the includes in the Nginx. If this is known, are there any special limitations while including system headers?<br>
</div>For sure this kind of behaviour is not nice and maybe it can be counted as bug (or at least be documented).<br><br><br></div>Regards,<br></div>Jure Menart<br></div>