RanniSch / webserv

0 stars 2 forks source link

SEGFAULT when changing the config #39

Closed MaxIhme closed 10 months ago

MaxIhme commented 10 months ago

tried with http://localhost:8000/cgi-bi.gh comes 404 - works as expected

change config to: server { error404 error/error500.html; }

and with the same url error 500 comes - works as expected

BUT SEGFAULT: "READING AND PARSING! [NOTHING] TMP_METHOD: [GET] CHOSEN METHOD: [GET] PREPARING RESPONSE 1 PREPARING RESPONSE 2 CRAFTED GET RESPONSE STR ACCEPT CONNECTION => 3DONE

WE HAVE FINISHED WRITING TO THE BROWSER Client Socket: 6 was closed successfuly File deleted successfully: tmp/tmp_file_6 make: *** [e] Segmentation fault: 11 mbp:simplified-serv maxrehberg$ "

tried again, no segfault. And then server was still running, klick on reload. Now hangs forever but gets every second a new PID -> new process???

restarted webserve. error 500 comes as expected. I can reload the page 4 times and all works.

change config to: server {

error404 error/error404.html;

}

default error page will be shown as expected. but again a segfault: "mbp:simplified-serv maxrehberg$ make e ./webserv conf/webserve_.conf Information: cannot open your config file. Will take default Config. TestServer constructor called! Start Listening... Start Listening... Start Listening... Finished creating the ports: Listening Socket onject for Port: 8000fd: 3 succesfully created! Listening Socket onject for Port: 8080fd: 4 succesfully created! Listening Socket onject for Port: 8090fd: 5 succesfully created! ERROR: poll() has timed out: : No such file or directory ACCEPT CONNECTION => 3DONE

READING AND PARSING! [NOTHING] TMP_METHOD: [GET] CHOSEN METHOD: [GET] PREPARING RESPONSE 1 PREPARING RESPONSE 2 CRAFTED GET RESPONSE STR ACCEPT CONNECTION => 3DONE

WE HAVE FINISHED WRITING TO THE BROWSER Client Socket: 6 was closed successfuly File deleted successfully: tmp/tmp_file_6 make: *** [e] Segmentation fault: 11 mbp:simplified-serv maxrehberg$ "

restart webserve. everything works. can load the page several times, all good.

change the config again to:

server { error404 error/error500.html; } -> error page correct in the browser, and again segfault:

"mbp:simplified-serv maxrehberg$ make e ./webserv conf/webserve_.conf Information: cannot open your config file. Will take default Config. TestServer constructor called! Start Listening... Start Listening... Start Listening... Finished creating the ports: Listening Socket onject for Port: 8000fd: 3 succesfully created! Listening Socket onject for Port: 8080fd: 4 succesfully created! Listening Socket onject for Port: 8090fd: 5 succesfully created! ERROR: poll() has timed out: : No such file or directory ACCEPT CONNECTION => 3DONE

READING AND PARSING! [NOTHING] TMP_METHOD: [GET] CHOSEN METHOD: [GET] PREPARING RESPONSE 1 PREPARING RESPONSE 2 CRAFTED GET RESPONSE STR ACCEPT CONNECTION => 3DONE

WE HAVE FINISHED WRITING TO THE BROWSER Client Socket: 6 was closed successfuly File deleted successfully: tmp/tmp_file_6 make: *** [e] Segmentation fault: 11 mbp:simplified-serv maxrehberg$ "

MaxIhme commented 10 months ago

Bildschirmfoto 2023-10-27 um 16 17 41

in void TestServer::_pollWriting -> go in if (file.eof()) -> _sockets_for_poll.erase(_it); -> Bad Access

MaxIhme commented 10 months ago

when it hangs and gets new pids all the time, looks like this in terminal:

Bildschirmfoto 2023-10-27 um 16 20 42
MaxIhme commented 10 months ago

and it hangs here: (Browser loads all the time Bildschirmfoto 2023-10-27 um 16 22 52

MaxIhme commented 10 months ago

config: location / { index index.html; allowed_Methods POST; }

location /delete_dir
{
    allow_methods DELETE;
}

location /static_website
{
    allow_methods GET;
    index static.html;
}

http://localhost:8000/ -> error page 405 method not allowed -> correct

but Segfault: "Listening Socket onject for Port: 8090fd: 5 succesfully created! ERROR: poll() has timed out: : No such file or directory ACCEPT CONNECTION => 3DONE

READING AND PARSING! [NOTHING] TMP_METHOD: [GET] CHOSEN METHOD: [GET] PREPARING RESPONSE 1 PREPARING RESPONSE 2 CRAFTED GET RESPONSE STR ACCEPT CONNECTION => 3DONE

WE HAVE FINISHED WRITING TO THE BROWSER Client Socket: 6 was closed successfuly File deleted successfully: tmp/tmp_file_6 make: *** [e] Segmentation fault: 11 mbp:simplified-serv maxrehberg$ "

restart try again, same segfault. restart try again, same segfault.

try: http://localhost:8000/static_website/ page loaded, pictures not, same segfault restart try again, same segfault.

restart try again, all good, i can reload the page. restart, browser hangs. debugging says it hangs at "int TestServer::checkPollAction(short revents, int fd)" second if (like in the screenshot).

RanniSch commented 10 months ago

Same issue like the one before, right? For me it is fine. @MaxIhme @LukasKava

LukasKava commented 10 months ago

SEEMS to be fixed tried it and no segfault @MaxIhme please test

RanniSch commented 10 months ago

Everything works fine