#869 also forget requests session in _forget()
Merged 5 years ago by mikem. Opened 5 years ago by mikem.
mikem/koji forget-rsession  into  master

file modified
+13 -1
@@ -2331,7 +2331,19 @@ 

          """Forget session information, but do not close the session

  

          This is intended to be used after a fork to prevent the subprocess

-         from affecting the session accidentally."""

+         from affecting the session accidentally.

+ 

+         Unfortunately the term session is overloaded. We forget:

+           - the login session

+           - the underlying python-requests session

+ 

+         But the ClientSession instance (i.e. self) persists

+         """

+ 

+         # forget our requests session

+         self.new_session()

+ 

+         # forget our login session, if any

          if not self.logged_in:

              return

          self.setSession(None)

Without this, the underlying requests session can persist after _forget(), which is typically used after a fork. It is not sane to recycle that connection in such situations.

rebased onto 024782e

5 years ago

Commit f9d3a73 fixes this pull-request

Pull-Request has been merged by mikem

5 years ago