Segfault with SPDY #142

Closed
baank opened this Issue Jul 16, 2012 · 12 comments

Comments

Projects
None yet
2 participants

baank commented Jul 16, 2012

Using Nginx 1.3.3 with SPDY patch I get the following segmentation fault:

Core was generated by `nginx: worker process '.
Program terminated with signal 11, Segmentation fault.
#0 ngx_epoll_add_event (ev=0xab31f0, event=4, flags=18446744071562067968) at src/event/modules/ngx_epoll_module.c:400

400 e = c->read;

With the following rewrite:

   rewrite_by_lua '
        email = ngx.var.arg_email;
        password = ngx.var.arg_password;

        if email and password then
            res = ngx.location.capture("/authenticate/" .. email .. "/" .. password);
            if res and res.status == 200 then
                if (res.body ~= "nouserid") then
                    return ngx.exec("/newsession/" .. res.body);
                end
            end
        end

        return ngx.exit(401);
    ';
Owner

agentzh commented Jul 16, 2012

Which version of SPDY patch are you using? It's known that early versions of the patch are very buggy and break things.

If you're not using the latest patch, please consider updating:

http://nginx.org/patches/spdy/

baank commented Jul 16, 2012

Latest version of the patch (47). I can update the ticket as new patches come along.

Is it best to raise this ticket against Nginx itself ?

Owner

agentzh commented Jul 16, 2012

Hello!

On Mon, Jul 16, 2012 at 2:04 PM, taligent
reply@reply.github.com
wrote:

Latest version of the patch (47). I can update the ticket as new patches come along.

Thanks for the report! I'll have a look when I have some time.

Is it best to raise this ticket against Nginx itself ?

As long as you can reproduce it with the standard nginx modules ;)
ngx_lua surely does not count here.

Best regards,
-agentzh

Owner

agentzh commented Jul 16, 2012

Hello!

On Mon, Jul 16, 2012 at 2:27 PM, agentzh agentzh@gmail.com wrote:

Thanks for the report! I'll have a look when I have some time.

BTW, could you provide the debug logs for your request? See
http://wiki.nginx.org/Debugging#Debugging_log for instructions.

Thanks!
-agentzh

Owner

agentzh commented Jul 16, 2012

Also, please consider preparing a minimized and self-contained config sample that can help reproducing the problem on our side. your example above references undefined locations like /authenticate/ and /newsession/. thanks!

baank commented Jul 16, 2012

Here are the debug logs and the relevant snippets from the config. I will have a self contained config sample by this time tomorrow.

Debug log:
https://gist.github.com/3125246

Config:
location ~* (/authenticate) {
proxy_cache_valid any 0m;
expires off;
proxy_set_header x-real-ip $remote_addr;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_pass http://backend;
}

location ~* ^/newsession/(.*)$ {
    default_type 'text/javascript';
    set_encrypt_session $session $1;
    set_encode_base32 $session;
    add_header Set-Cookie "session=$session; path=/; Expires=Wed, 13-Jan-2021 22:23:01 GMT; ";
    echo "{ \"status\": \"success\" }";
}
Owner

agentzh commented Jul 18, 2012

Thanks! I'll look into this!

Owner

agentzh commented Jul 18, 2012

BTW, are you doing a SPDY request or just a normal HTTP one? Can you also provide the sample request?

baank commented Jul 18, 2012

Does not work with SPDY. Works great with HTTPS.

The URL is "http://host/login?email=X&password=Y".

Is that what you mean by request or did you want me to do capture a session with Wireshark ?

Owner

agentzh commented Jul 18, 2012

Hello!

On Tue, Jul 17, 2012 at 9:46 PM, taligent
reply@reply.github.com
wrote:

Does not work with SPDY. Works great with HTTPS.

The URL is "http://host/login?email=X&password=Y".

Is that what you mean by request or did you want me to do capture a session with Wireshark ?

Yes, please :) Or just nc ;)

Best reagards,
-agentzh

Owner

agentzh commented Mar 1, 2014

@baank I just committed a patch in the hope to fix this in git master. Will you try it out again on your side? BTW, you are recommended to use a recent enough NGINX with builtin SPDY support rather than using the obsolete SPDY patch :) Sorry for the long delay on my side!

Owner

agentzh commented Feb 16, 2016

SPDY is now dead. I'm closing this.

@agentzh agentzh closed this Feb 16, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment