Open KrolPolski opened 3 days ago
% valgrind ./webserv
==721092== Memcheck, a memory error detector
==721092== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==721092== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==721092== Command: ./webserv
==721092==
==721092== Conditional jump or move depends on uninitialised value(s)
==721092== at 0x402BD7: ConnectionHandler::startServers() (in /home/rboudwin/repos/webserv/webserv)
==721092== by 0x402609: main (in /home/rboudwin/repos/webserv/webserv)
==721092==
==721092== Conditional jump or move depends on uninitialised value(s)
==721092== at 0x402C42: ConnectionHandler::startServers() (in /home/rboudwin/repos/webserv/webserv)
==721092== by 0x402609: main (in /home/rboudwin/repos/webserv/webserv)
==721092==
==721092== Conditional jump or move depends on uninitialised value(s)
==721092== at 0x402CA8: ConnectionHandler::startServers() (in /home/rboudwin/repos/webserv/webserv)
==721092== by 0x402609: main (in /home/rboudwin/repos/webserv/webserv)
==721092==
With a little more detail:
rboudwin@c2r2p1 ~/repos/webserv
% valgrind --track-origins=yes ./webserv
==727374== Memcheck, a memory error detector
==727374== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==727374== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==727374== Command: ./webserv
==727374==
==727374== Conditional jump or move depends on uninitialised value(s)
==727374== at 0x402BB7: ConnectionHandler::startServers() (in /home/rboudwin/repos/webserv/webserv)
==727374== by 0x4025E9: main (in /home/rboudwin/repos/webserv/webserv)
==727374== Uninitialised value was created by a stack allocation
==727374== at 0x402A50: ConnectionHandler::addNewPollfd(int) (in /home/rboudwin/repos/webserv/webserv)
==727374==
==727374== Conditional jump or move depends on uninitialised value(s)
==727374== at 0x402C22: ConnectionHandler::startServers() (in /home/rboudwin/repos/webserv/webserv)
==727374== by 0x4025E9: main (in /home/rboudwin/repos/webserv/webserv)
==727374== Uninitialised value was created by a stack allocation
==727374== at 0x402A50: ConnectionHandler::addNewPollfd(int) (in /home/rboudwin/repos/webserv/webserv)
==727374==
==727374== Conditional jump or move depends on uninitialised value(s)
==727374== at 0x402C88: ConnectionHandler::startServers() (in /home/rboudwin/repos/webserv/webserv)
==727374== by 0x4025E9: main (in /home/rboudwin/repos/webserv/webserv)
==727374== Uninitialised value was created by a stack allocation
==727374== at 0x402A50: ConnectionHandler::addNewPollfd(int) (in /home/rboudwin/repos/webserv/webserv)
==727374==
==727374== Invalid read of size 4
==727374== at 0x403157: ConnectionHandler::sendDataToClient(unsigned int) (in /home/rboudwin/repos/webserv/webserv)
==727374== by 0x402CCD: ConnectionHandler::startServers() (in /home/rboudwin/repos/webserv/webserv)
==727374== by 0x4025E9: main (in /home/rboudwin/repos/webserv/webserv)
==727374== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==727374==
==727374==
==727374== Process terminating with default action of signal 11 (SIGSEGV)
==727374== Access not within mapped region at address 0x0
==727374== at 0x403157: ConnectionHandler::sendDataToClient(unsigned int) (in /home/rboudwin/repos/webserv/webserv)
==727374== by 0x402CCD: ConnectionHandler::startServers() (in /home/rboudwin/repos/webserv/webserv)
==727374== by 0x4025E9: main (in /home/rboudwin/repos/webserv/webserv)
==727374== If you believe this happened as a result of a stack
==727374== overflow in your program's main thread (unlikely but
==727374== possible), you can try to increase the size of the
==727374== main thread stack using the --main-stacksize= flag.
==727374== The main thread stack size used in this run was 8388608.
==727374==
==727374== HEAP SUMMARY:
==727374== in use at exit: 73,826 bytes in 6 blocks
==727374== total heap usage: 16 allocs, 10 frees, 74,555 bytes allocated
==727374==
==727374== LEAK SUMMARY:
==727374== definitely lost: 0 bytes in 0 blocks
==727374== indirectly lost: 0 bytes in 0 blocks
==727374== possibly lost: 0 bytes in 0 blocks
==727374== still reachable: 73,826 bytes in 6 blocks
==727374== suppressed: 0 bytes in 0 blocks
==727374== Rerun with --leak-check=full to see details of leaked memory
==727374==
==727374== For lists of detected and suppressed errors, rerun with: -s
==727374== ERROR SUMMARY: 7 errors from 4 contexts (suppressed: 0 from 0)
zsh: segmentation fault (core dumped) valgrind --track-origins=yes ./webserv
rboudwin@c2r2p1 ~/repos/webserv
%
Segfault confirmed to be fixed by Commit 1aad7ab, tested on Linux Mint. We still need to ensure bindings are released on errors.
This occurs on school computers. The first time it happened was after I clicked the link to the second page. But this behavior is inconsistent and sometimes happens after the first page is served.