diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-05-21 18:00:25 +0200 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-05-21 18:00:25 +0200 |
commit | 4b34a4d950f762b5d020d5ac4d3354836833039c (patch) | |
tree | 6753cadbc2d4d956d18b045207278562bc9a56ee /plugins/fcgi/fcgi.cpp | |
parent | 72a0f20c07ecf321a4d15f5afe8938eb2b509668 (diff) |
FCGI: Fix connection handling on broken pipe: Reopen new socket
Diffstat (limited to 'plugins/fcgi/fcgi.cpp')
-rw-r--r-- | plugins/fcgi/fcgi.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/fcgi/fcgi.cpp b/plugins/fcgi/fcgi.cpp index 5a7ce65..7748845 100644 --- a/plugins/fcgi/fcgi.cpp +++ b/plugins/fcgi/fcgi.cpp @@ -357,7 +357,7 @@ std::string fcgi_plugin::fcgiQuery(FCGIContext& context) std::lock_guard<std::mutex> socket_lock{socket->getMutex()}; if (!socket->is_open()) { - //std::cout << "FCGI: Opening new socket" << std::endl; + std::cout << "FCGI: Opening new socket to " << app_addr << std::endl; socket->open(); opening = true; @@ -402,7 +402,12 @@ std::string fcgi_plugin::fcgiQuery(FCGIContext& context) std::cerr << "Warning: Not all bytes written" << std::endl; } catch (const fcgi_eof_error&) { std::cerr << "FCGI Error: EOF on write" << std::endl; // seems to be ok here + m_sockets.erase(app_addr); // force new socket next time return HttpStatus("500", "FCGI connection: EOF on write", context.SetResponseHeader); + } catch (const fcgi_broken_pipe_error&) { + std::cerr << "FCGI Error: Broken pipe on write" << std::endl; // seems to be ok here + m_sockets.erase(app_addr); // force new socket next time + return HttpStatus("500", "FCGI connection: Broken pipe on write", context.SetResponseHeader); } #if 0 @@ -418,7 +423,8 @@ std::string fcgi_plugin::fcgiQuery(FCGIContext& context) try { socket->read(inbuf); } catch (const fcgi_eof_error&) { - std::cerr << "FCGI Warning: Early EOF" << std::endl; // seems to be ok here + std::cerr << "FCGI Warning: Early EOF from application server. Break." << std::endl; // seems to be ok here + m_sockets.erase(app_addr); // force new socket next time ended = true; //return HttpStatus("500", "FCGI connection: EOF on read", context.SetResponseHeader); } |