Welcome! Log In Create A New Profile

Advanced

Re: Nginx modules & C includes

Jure Menart
August 31, 2013 05:14PM
Hello Valentin,

thank you very much :-)
Well... this was one of the rare examples I obviously did not check today.

Regards,
Jure Menart


On Sat, Aug 31, 2013 at 11:08 PM, Valentin V. Bartenev <vbart@nginx.com>wrote:

> On Sunday 01 September 2013 00:35:20 Jure Menart wrote:
> > Dear all,
> >
> > 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.
> >
> > 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:
> > - I've been playing with Hello world examples of course and then started
> to
> > build bigger 'real' module.
> > - Suddenly I've got very unpredictable behaviour and seg. faults.
> > - 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.
> > - 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:
> > For example:
> > <-- snip -->
> > #include <sys/types.h>
> > #include <sys/stat.h>
> > #include <unistd.h>
> >
> > #include <ngx_config.h>
> > #include <ngx_core.h>
> > #include <ngx_http.h>
> > <-- snip -->
> >
> > Crashes my module, while:
> > <-- snip -->
> > #include <ngx_config.h>
> > #include <ngx_core.h>
> > #include <ngx_http.h>
> >
> > #include <sys/types.h>
> > #include <sys/stat.h>
> > #include <unistd.h>
> > <-- snip -->
> >
> > Seems to work.
> >
> > 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?
> > For sure this kind of behaviour is not nice and maybe it can be counted
> as
> > bug (or at least be documented).
> >
>
> There is a commentary in the C++ example module (the only example that we
> have):
>
> http://trac.nginx.org/nginx/browser/nginx/src/misc/ngx_cpp_test_module.cpp#L19
>
> // nginx header files should go before other, because they define 64-bit
> off_t
>
> wbr, Valentin V. Bartenev
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Nginx modules & C includes

Jure Menart 1186 August 31, 2013 04:36PM

Re: Nginx modules & C includes

Valentin V. Bartenev 407 August 31, 2013 05:10PM

Re: Nginx modules & C includes

Jure Menart 534 August 31, 2013 05:14PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 280
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready