Don't report internal error if gpfdist session is closed
In the case of something like "select ... limit 1;", there may be
attach request after session is closed. Then we should ignore the
error code of session and just return a empty HTTP OK.
@@ -1641,14 +1641,6 @@ static int session_attach(request_t* r)
/* found a session in hashtable*/
- /* if error, send an error and close */
- if (session->is_error)
- {
- http_error(r, FDIST_INTERNAL_ERROR, "session error");
- request_end(r, 1, 0);
- return -1;
- }
-
/* session already ended. send an empty response, and close. */
if (NULL == session->fstream)
{
@@ -1659,6 +1651,14 @@ static int session_attach(request_t* r)
return -1;
}
+ /* if error, send an error and close */
+ if (session->is_error)
+ {
+ http_error(r, FDIST_INTERNAL_ERROR, "session error");
+ request_end(r, 1, 0);
+ return -1;
+ }
+
/*
* disallow mixing GET and POST requests in one session.
* this will protect us from an infinitely running
