Hi David,

yes, exactlty. It is strange that this did not show up earlier, but since we use naviserver on most sites with openacs, this was not an issue, since ns_return or "ns_writer submitfile" don't reach the nested corking cases as in fastpath + ssl. In sites without ssl, this bug
does not show up at all.

we should develop test cases for nsssl.

Anyhow, we will do some more testing and we should publish a bugfix release
soon... if nothing more shows up, maybe this weekend.

many thanks for your help!

-g

Am 10.03.15 um 11:43 schrieb David Osborne:
Could this be the problem? Sees to alleviate the symptoms for me certainly..

diff -r 096278955dc1 nsd/sockfile.c
--- a/nsd/sockfile.c  Wed Mar 04 04:29:31 2015 +0100
+++ b/nsd/sockfile.c  Tue Mar 10 10:42:44 2015 +0000
@@ -386,7 +386,7 @@
 int
 Ns_SockCork(Ns_Sock *sock, int cork)
 {
-    int success = 1;
+    int success = 0;
 #ifdef TCP_CORK
     Sock *sockPtr = (Sock *)sock;



On 9 March 2015 at 16:24, David Osborne <da...@qcode.co.uk <mailto:da...@qcode.co.uk>> wrote:

    Hi again,

    We're getting some Error messages when we're browsing fastpath
    pages running tip via https.
    Not sure of this is anything to actually to worry about since
    there doesn't seem to be any side-effect except for the frequent
    error messages in the log.

    *[09/Mar/2015:15:59:06][17560.7fffedf37700][-conn:default:4-]
    Error: socket: trying to uncork an uncorked socket 10*

    It appears pretty much every time we click on a link.

    *
    *
    *Test case:
    *

    Building with the tip versions of naviserver and nsssl (but with
    the configure.ac <http://configure.ac> change to CCRFLAG/LDRFLAG
    we discussed)

    Add the following to the end of the default
     /usr/local/ns/conf/nsd-config.tcl:

     ns_section    ns/server/default/module/nsssl
     ns_param      certificate  /usr/local/ns/modules/nsssl/server.pem
     ns_param      address              0.0.0.0
     ns_param      port                 443
     ns_param      ciphers
     
"ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!RC4
    "
     ns_param      protocols            "!SSLv2"
     ns_param      verify                0

     ns_param      extraheaders {
    Strict-Transport-Security "max-age=31536000; includeSubDomains"
    X-Frame-Options SAMEORIGIN
    X-Content-Type-Options nosniff
         }

    List nsssl.so in the module list

    ns_section   "ns/server/default/modules"
    ns_param    nscp                nscp.so
    ns_param    nssock              nssock.so
    ns_param    nslog               nslog.so
    ns_param    nscgi               nscgi.so
    ns_param    nsdb                nsdb.so
    ns_param  nsssl                        nsssl.so

    Do the following to generate a self-signed cert:

         openssl genrsa 1024 > host.key
         openssl req -new -x509 -nodes -sha1 -days 365 -key host.key > host.cert
         cat host.cert host.key > server.pem
         rm -rf host.cert host.key
         openssl dhparam 2048 >> server.pem



    Run:
    /usr/local/ns/bin/nsd -c -u root -t /usr/local/ns/conf/nsd-config.tcl

    Browsing to https://servername/doc/index.html then clicking on one
    of the command names (eg. to take us
    https://servername/doc/naviserver/files/ns_adp_break.html) will
    cause the error.


    I tried to catch this in gdb by setting a breakpoint on Ns_Log
    with severity Error:

    ...
    [09/Mar/2015:15:49:37][17543.7fffef22d700][-sched-] Notice: sched:
    starting
    [Switching to Thread 0x7fffedf37700 (LWP 17554)]

    Breakpoint 3, Ns_Log (severity=severity@entry=2,
    fmt=fmt@entry=0x7ffff7bbabe0 "socket: trying to uncork an uncorked
    socket %d")
        at log.c:481
    481     {
    (gdb)  bt
    #0  Ns_Log (severity=severity@entry=2,
    fmt=fmt@entry=0x7ffff7bbabe0 "socket: trying to uncork an uncorked
    socket %d")
        at log.c:481
    #1  0x00007ffff7b91516 in Ns_SockCork
    (sock=sock@entry=0x7ffff001c9a0, cork=cork@entry=0) at sockfile.c:405
    #2  0x00007ffff7b9166a in SendFd (sock=sock@entry=0x7ffff001c9a0,
    fd=11, offset=10165, length=length@entry=10165,
    timeoutPtr=timeoutPtr@entry=0x7fffedf36110, flags=flags@entry=0,
    sendProc=sendProc@entry=0x7fffee798b70 <Send>)
        at sockfile.c:481
    #3  0x00007ffff7b913e9 in NsSockSendFileBufsIndirect
    (sock=0x7ffff001c9a0, bufs=<optimized out>, nbufs=<optimized out>,
    timeoutPtr=timeoutPtr@entry=0x7fffedf36110, flags=0,
    sendProc=0x7fffee798b70 <Send>) at sockfile.c:309
    #4  0x00007ffff7b75fc7 in NsDriverSendFile (sockPtr=<optimized
    out>, bufs=bufs@entry=0x7fffedf363a0, nbufs=nbufs@entry=1,
    flags=flags@entry=0) at driver.c:1133
    #5  0x00007ffff7b72ea9 in Ns_ConnSendFileVec
    (conn=conn@entry=0x66ecb0, bufs=bufs@entry=0x7fffedf363a0, nbufs=1)
        at connio.c:525
    #6  0x00007ffff7b8be86 in ReturnRange (conn=conn@entry=0x66ecb0,
    type=type@entry=0x627c90 "text/html", fd=fd@entry=11,
    data=data@entry=0x0, len=len@entry=10165) at return.c:988
    #7  0x00007ffff7b8bc64 in ReturnOpen (conn=conn@entry=0x66ecb0,
    status=status@entry=200, type=type@entry=0x627c90 "text/html",
    chan=chan@entry=0x0, fp=fp@entry=0x0, fd=fd@entry=11, len=10165)
    at return.c:881
    #8  0x00007ffff7b8bbe5 in Ns_ConnReturnOpenFd
    (conn=conn@entry=0x66ecb0, status=status@entry=200,
    type=type@entry=0x627c90 "text/html", fd=fd@entry=11,
    len=<optimized out>) at return.c:854
    #9  0x00007ffff7b7c7fd in FastReturn (conn=conn@entry=0x66ecb0,
    status=status@entry=200, type=0x627c90 "text/html",
    type@entry=0x0, file=0x7fffedf36b00
    "/usr/local/ns/pages/doc/naviserver/files/ns_adp_ctl.html") at
    fastpath.c:570
    #10 0x00007ffff7b7c4c3 in Ns_FastPathProc (UNUSED_arg=<optimized
    out>, conn=0x66ecb0) at fastpath.c:244
    #11 0x00007ffff7b85059 in Ns_ConnRunRequest
    (conn=conn@entry=0x66ecb0) at op.c:293
    #12 0x00007ffff7b89283 in ConnRun (connPtr=0x66ecb0,
    argPtr=0x16c6a70) at queue.c:1513
    #13 NsConnThread (arg=0x16c6a70) at queue.c:1229
    #14 0x00007ffff74ea77c in NsThreadMain (arg=<optimized out>) at
    thread.c:227
    #15 0x00007ffff74eb6c9 in ThreadMain (arg=<optimized out>) at
    pthread.c:809
    #16 0x00007ffff64ed0a4 in start_thread () from
    /lib/x86_64-linux-gnu/libpthread.so.0
    #17 0x00007ffff69ebccd in clone () at
    ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
    (gdb) frame 0
    #0  Ns_Log (severity=severity@entry=2,
    fmt=fmt@entry=0x7ffff7bbabe0 "socket: trying to uncork an uncorked
    socket %d")
        at log.c:481
    481     {
    (gdb) frame 1
    #1  0x00007ffff7b91516 in Ns_SockCork
    (sock=sock@entry=0x7ffff001c9a0, cork=cork@entry=0) at sockfile.c:405
    405   Ns_Log(Error, "socket: trying to uncork an uncorked socket %d",
    (gdb) print *sock
    $1 = {driver = 0x654c50, sock = 10, sa = {sin_family = 2, sin_port
    = 46046, sin_addr = {s_addr = 191146176},
        sin_zero = "\000\000\000\000\000\000\000"}, arg = 0x7ffff006f510}

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to