loentar / ngrest

Fast and easy C++ RESTful WebServices framework
Apache License 2.0
464 stars 93 forks source link

not file description bug #49

Closed klepsydra-technologies closed 6 years ago

klepsydra-technologies commented 6 years ago

Dear all,

when running ngrest with callbacks, I get a file description error regularly, I think it is related to these lines in the Server.cpp (line 325)

    if (res == -1) 
         LogError() << "Failed to remove client " << Error::getLastError();

Which it should be:

    if (res == -1) {
         LogError() << "Failed to remove client " << Error::getLastError();
        return;
    }

Please let me know if this makes sense.

Thanks,

Pablo.

loentar commented 6 years ago

Well, if you place return after log, no connection will be closed and it will leaked. After some time you'll not be able to accept new connections.

What do you mean under file description error? Please send some logs with that errors.

klepsydra-technologies commented 6 years ago

This is the error:

Got it again, without the change I did: E/16-01-2018 03:34:49.789 Server.cpp:325 closeConnection: Failed to remove client Bad file descriptor Error in `./bin/kpsr_bst_eventloop_example': double free or corruption (out): 0x00007f4140003200 ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f41478fa7e5] /lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7f414790337a] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f414790753c] /opt/klepsydra/lib/libkpsr_admin.so(_ZN6ngrest13ClientHandler12disconnectedEi+0xc2)[0x7f41489dbc66] /opt/klepsydra/lib/libkpsr_admin.so(_ZN6ngrest6Server15closeConnectionEi+0x10a)[0x7f41489e2e84] /opt/klepsydra/lib/libkpsr_admin.so(_ZN6ngrest13ClientHandler15processResponseEPNS_13ClientContextE+0x58d)[0x7f41489de277] /opt/klepsydra/lib/libkpsr_admin.so(_ZN6ngrest21ClientHandlerCallback7successEv+0x27)[0x7f41489df763] /home/pablogh/thirdparties/klepsydra/kpsr-bst/../../ngrest/build/deploy/lib/libngrestengine.so(_ZN6ngrest18EngineHookCallback7successEv+0xf1)[0x7f4146cb4173]

klepsydra-technologies commented 6 years ago

never happened again. I might have been something I did.