[Bug 1863232] Re: daemon rotates socket on restart

2020-09-22 Thread Mauricio Faria de Oliveira
** Tags removed: sts-sponsor-mfo

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-03-02 Thread Launchpad Bug Tracker
This bug was fixed in the package mod-wsgi - 4.3.0-1.1ubuntu1

---
mod-wsgi (4.3.0-1.1ubuntu1) xenial; urgency=medium

  * d/p/allow-disabling-daemon-socket-rotation-on-restart.patch:
Add option for disabling daemon socket rotation on restarts (LP: #1863232)

 -- Dariusz Gadomski   Fri, 14 Feb 2020
12:36:00 +0100

** Changed in: mod-wsgi (Ubuntu Xenial)
   Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-03-02 Thread Launchpad Bug Tracker
This bug was fixed in the package mod-wsgi - 4.5.17-1ubuntu1

---
mod-wsgi (4.5.17-1ubuntu1) bionic; urgency=medium

  * d/p/allow-disabling-daemon-socket-rotation-on-restart.patch:
Add option for disabling daemon socket rotation on restarts (LP: #1863232)

 -- Dariusz Gadomski   Fri, 14 Feb 2020
12:08:41 +0100

** Changed in: mod-wsgi (Ubuntu Bionic)
   Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-20 Thread Dariusz Gadomski
Xenial verification:
Similarly to bionic with Xenial version of libapache2-mod-wsgi 4.3.0-1.1ubuntu1 
and setting
WSGISocketRotation Off
in /etc/apache2/conf-enabled/wsgi.conf there's no socket rotation:
$ ls -1 /var/run/apache2/wsgi.*.sock
/var/run/apache2/wsgi.3170.u33.1.sock
$ sudo systemctl reload apache2.service
$ ls -1 /var/run/apache2/wsgi.*.sock
/var/run/apache2/wsgi.3170.u33.1.sock
$ apt-cache policy libapache2-mod-wsgi | grep Installed
  Installed: 4.3.0-1.1ubuntu1

** Tags removed: verification-needed verification-needed-xenial
** Tags added: verification-done verification-done-xenial

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-20 Thread Dariusz Gadomski
Bionic verification:
After installing libapache2-mod-wsgi 4.5.17-1ubuntu1 and setting
WSGISocketRotation Off
in /etc/apache2/mods-available/wsgi.conf I confirm there is no socket rotation 
after reload:

$ ls -1 /var/run/apache2/wsgi.*.sock
/var/run/apache2/wsgi.4963.u33.1.sock
$ sudo systemctl reload apache2.service
$ ls -1 /var/run/apache2/wsgi.*.sock
/var/run/apache2/wsgi.4963.u33.1.sock


** Tags removed: verification-needed-bionic
** Tags added: verification-done-bionic

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-20 Thread Łukasz Zemczak
Hello Dariusz, or anyone else affected,

Accepted mod-wsgi into xenial-proposed. The package will build now and
be available at https://launchpad.net/ubuntu/+source/mod-
wsgi/4.3.0-1.1ubuntu1 in a few hours, and then in the -proposed
repository.

Please help us by testing this new package.  See
https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how
to enable and use -proposed.  Your feedback will aid us getting this
update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug,
mentioning the version of the package you tested and change the tag from
verification-needed-xenial to verification-done-xenial. If it does not
fix the bug for you, please add a comment stating that, and change the
tag to verification-failed-xenial. In either case, without details of
your testing we will not be able to proceed.

Further information regarding the verification process can be found at
https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  Thank you in
advance for helping!

N.B. The updated package will be released to -updates after the bug(s)
fixed by this package have been verified and the package has been in
-proposed for a minimum of 7 days.

** Changed in: mod-wsgi (Ubuntu Xenial)
   Status: In Progress => Fix Committed

** Tags added: verification-needed-xenial

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-20 Thread Łukasz Zemczak
Hello Dariusz, or anyone else affected,

Accepted mod-wsgi into bionic-proposed. The package will build now and
be available at https://launchpad.net/ubuntu/+source/mod-
wsgi/4.5.17-1ubuntu1 in a few hours, and then in the -proposed
repository.

Please help us by testing this new package.  See
https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how
to enable and use -proposed.  Your feedback will aid us getting this
update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug,
mentioning the version of the package you tested and change the tag from
verification-needed-bionic to verification-done-bionic. If it does not
fix the bug for you, please add a comment stating that, and change the
tag to verification-failed-bionic. In either case, without details of
your testing we will not be able to proceed.

Further information regarding the verification process can be found at
https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  Thank you in
advance for helping!

N.B. The updated package will be released to -updates after the bug(s)
fixed by this package have been verified and the package has been in
-proposed for a minimum of 7 days.

** Changed in: mod-wsgi (Ubuntu Bionic)
   Status: In Progress => Fix Committed

** Tags added: verification-needed verification-needed-bionic

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-18 Thread Mauricio Faria de Oliveira
Uploaded changes to B/X.

There are no other mod-wsgi uploads in the unapproved queue nor waiting
in -proposed/pending SRU.

mod-wsgi (source)
4.5.17-1ubuntu1 mainpython  medium  ubuntu-server   
Proposed56 seconds ago

 mod-wsgi (source)
4.3.0-1.1ubuntu1mainpython  medium  ubuntu-server   
Proposed53 seconds ago

** Changed in: mod-wsgi (Ubuntu Xenial)
   Importance: Undecided => Medium

** Changed in: mod-wsgi (Ubuntu Bionic)
   Importance: Undecided => Medium

** Changed in: mod-wsgi (Ubuntu)
   Importance: Low => Undecided

** Description changed:

  [Impact]
  
   * Lack of option for disabling wsgi socket rotation leads to errors on 
graceful restarts, making them not as graceful.
   * Specifically, when mod-wsgi is running in daemon mode (which uses
     sockets), and a graceful restart ('sudo systemctl reload apache2')
     happens, the socket filename changes, and upcoming HTTP requests
     in a keep-alive connection (i.e., same connection is re-utilized
     for multiple HTTP requests) initiated before the graceful restart
     are failed (HTTP 503 error) because the socket file is not found.
  
   * This change introduces a new config option WSGISocketRotation that allows 
to disable the rotation.
   * The option is disabled by default, so the default behavior remains
     consistent with the previous versions (ie, socket rotation occurs.)
   * This is actually desired, and designed that way by upstream,
     because disabling socket rotation requires no _wsgi_ config changes,
     as they can impact/alter the upcoming HTTP requests (see patch link.)
  
  [Test Case]
  
   * Setup apache2 with mod-wsgi.
   * Make sure there are some wsgi sockets open.
   * Reload apache gracefully.
   * (Detailed steps are provided in comments #9 and #10)
  
  Expected result:
  No errors related to sockets in the logs
  
  Actual result:
  There are error messages related to sockets in the logs.
  
  [Regression Potential]
  
   * Since the value is set to On by default any regressions would manifest 
only after explicitly setting it to Off.
   * After it's set to off WSGI application behavior will change on reloads - 
connections should be resumed instead of cancelled.
  
  [Other Info]
  
+  * The fix has been introduced in mod-wsgi 4.6.0,
+thus already present in Disco/Eoan/Focal,
+only needed in Xenial/Bionic.
+ 
   * Original bug description:
  On Apache reloads the WSGI daemon tries to rotate wsgi sockets causing 
unnecessary log entries, especially in OpenStack context.
  
  This has been addressed in mod-wsgi upstream (4.6.0) and could be
  backported to Ubuntu.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-18 Thread Mauricio Faria de Oliveira
** Description changed:

  [Impact]
  
-  * Lack of option for disabling wsgi socket rotation leads to errors on 
graceful restarts, making them not as graceful.
-  * This change introduces a new config option WSGISocketRotation that allows 
to disable the rotation.
+  * Lack of option for disabling wsgi socket rotation leads to errors on 
graceful restarts, making them not as graceful.
+  * Specifically, when mod-wsgi is running in daemon mode (which uses
+sockets), and a graceful restart ('sudo systemctl reload apache2')
+happens, the socket filename changes, and upcoming HTTP requests
+in a keep-alive connection (i.e., same connection is re-utilized
+for multiple HTTP requests) initiated before the graceful restart
+are failed (HTTP 503 error) because the socket file is not found.
+  * This change introduces a new config option WSGISocketRotation that allows 
to disable the rotation.
+  * The option is disabled by default, so the default behavior remains
+consistent with the previous versions (ie, socket rotation occurs.)
+  * This is actually desired, and designed that way by upstream,
+because disabling socket rotation requires no _wsgi_ config changes,
+as they can impact/alter the upcoming HTTP requests (see patch link.)
  
  [Test Case]
  
-  * Setup apache2 with mod-wsgi.
-  * Make sure there are some wsgi sockets open.
-  * Reload apache gracefully.
+  * Setup apache2 with mod-wsgi.
+  * Make sure there are some wsgi sockets open.
+  * Reload apache gracefully.
+  * (Detailed steps are provided in comments #9 and #10)
  
  Expected result:
  No errors related to sockets in the logs
  
  Actual result:
  There are error messages related to sockets in the logs.
  
  [Regression Potential]
  
-  * Since the value is set to On by default any regressions would manifest 
only after explicitly setting it to Off.
-  * After it's set to off WSGI application behavior will change on reloads - 
connections should be resumed instead of cancelled.
+  * Since the value is set to On by default any regressions would manifest 
only after explicitly setting it to Off.
+  * After it's set to off WSGI application behavior will change on reloads - 
connections should be resumed instead of cancelled.
  
  [Other Info]
-  
-  * Original bug description:
+ 
+  * Original bug description:
  On Apache reloads the WSGI daemon tries to rotate wsgi sockets causing 
unnecessary log entries, especially in OpenStack context.
  
  This has been addressed in mod-wsgi upstream (4.6.0) and could be
  backported to Ubuntu.

** Description changed:

  [Impact]
  
   * Lack of option for disabling wsgi socket rotation leads to errors on 
graceful restarts, making them not as graceful.
-  * Specifically, when mod-wsgi is running in daemon mode (which uses
-sockets), and a graceful restart ('sudo systemctl reload apache2')
-happens, the socket filename changes, and upcoming HTTP requests
-in a keep-alive connection (i.e., same connection is re-utilized
-for multiple HTTP requests) initiated before the graceful restart
-are failed (HTTP 503 error) because the socket file is not found.
+  * Specifically, when mod-wsgi is running in daemon mode (which uses
+    sockets), and a graceful restart ('sudo systemctl reload apache2')
+    happens, the socket filename changes, and upcoming HTTP requests
+    in a keep-alive connection (i.e., same connection is re-utilized
+    for multiple HTTP requests) initiated before the graceful restart
+    are failed (HTTP 503 error) because the socket file is not found.
+ 
   * This change introduces a new config option WSGISocketRotation that allows 
to disable the rotation.
-  * The option is disabled by default, so the default behavior remains
-consistent with the previous versions (ie, socket rotation occurs.)
-  * This is actually desired, and designed that way by upstream,
-because disabling socket rotation requires no _wsgi_ config changes,
-as they can impact/alter the upcoming HTTP requests (see patch link.)
+  * The option is disabled by default, so the default behavior remains
+    consistent with the previous versions (ie, socket rotation occurs.)
+  * This is actually desired, and designed that way by upstream,
+    because disabling socket rotation requires no _wsgi_ config changes,
+    as they can impact/alter the upcoming HTTP requests (see patch link.)
  
  [Test Case]
  
   * Setup apache2 with mod-wsgi.
   * Make sure there are some wsgi sockets open.
   * Reload apache gracefully.
-  * (Detailed steps are provided in comments #9 and #10)
+  * (Detailed steps are provided in comments #9 and #10)
  
  Expected result:
  No errors related to sockets in the logs
  
  Actual result:
  There are error messages related to sockets in the logs.
  
  [Regression Potential]
  
   * Since the value is set to On by default any regressions would manifest 
only after explicitly setting it to Off.
   * After it's set to off WSGI 

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-18 Thread Mauricio Faria de Oliveira
Steps to reproduce/verify on Bionic:
===

Similarly to steps described for Xenial.
Skipping the identical steps.

$ lxc launch ubuntu:bionic lp1863232b
$ lxc exec lp1863232b -- su - ubuntu


One connection/Two requests (added timestamps to check timeout values)
---

$ (cat http-request; sleep 1; cat http-request; sleep 9) | telnet 127.0.0.1 80 
2>&1 | while read line; do echo "$(date +'%T') == $line"; done
00:03:46 == Trying 127.0.0.1...
00:03:46 == Connected to 127.0.0.1.
00:03:46 == Escape character is '^]'.
00:03:46 == HTTP/1.1 200 OK
00:03:46 == Date: Tue, 18 Feb 2020 00:03:46 GMT
00:03:46 == Server: Apache/2.4.29 (Ubuntu)
00:03:46 == Content-Length: 13
00:03:46 == Vary: Accept-Encoding
00:03:46 == Keep-Alive: timeout=15, max=100
00:03:46 == Connection: Keep-Alive
00:03:46 == Content-Type: text/plain
00:03:46 == 
00:03:46 == Hello World!
00:03:47 == HTTP/1.1 200 OK
00:03:47 == Date: Tue, 18 Feb 2020 00:03:47 GMT
00:03:47 == Server: Apache/2.4.29 (Ubuntu)
00:03:47 == Content-Length: 13
00:03:47 == Vary: Accept-Encoding
00:03:47 == Keep-Alive: timeout=15, max=99
00:03:47 == Connection: Keep-Alive
00:03:47 == Content-Type: text/plain
00:03:47 == 
00:03:47 == Hello World!
00:03:56 == Connection closed by foreign host.


Reproduce the problem by placing
'sudo systemctl reload apache2'
between the two HTTP requests
(second request hits Error 503,
depending on apache2 MPM module.
mpm_event just closes connection,
mpm_worker/mpm_prefork hit 503)
---

$ lsb_release -cs
bionic

$ dpkg -s libapache2-mod-wsgi | grep ^Version
Version: 4.5.17-1


$ sudo a2dismod mpm_event
$ sudo a2enmod mpm_worker
$ sudo systemctl restart apache2

For reference on socket filename:

$ sudo systemctl restart apache2

$ ls -1 /var/run/apache2/wsgi.*.sock
/var/run/apache2/wsgi.4982.0.1.sock

$ (cat http-request; sleep 1; sudo systemctl reload apache2; sleep 5; cat 
http-request; sleep 9) | telnet 127.0.0.1 80 2>&1 | while read line; do echo 
"$(date +'%T') == $line"; done
14:46:04 == Trying 127.0.0.1...
14:46:04 == Connected to 127.0.0.1.
14:46:04 == Escape character is '^]'.
14:46:04 == HTTP/1.1 200 OK
14:46:04 == Date: Tue, 18 Feb 2020 14:46:04 GMT
14:46:04 == Server: Apache/2.4.29 (Ubuntu)
14:46:04 == Content-Length: 13
14:46:04 == Vary: Accept-Encoding
14:46:04 == Keep-Alive: timeout=15, max=100
14:46:04 == Connection: Keep-Alive
14:46:04 == Content-Type: text/plain
14:46:04 == 
14:46:04 == Hello World!
14:46:10 == HTTP/1.1 503 Service Unavailable
14:46:10 == Date: Tue, 18 Feb 2020 14:46:10 GMT
14:46:10 == Server: Apache/2.4.29 (Ubuntu)
14:46:10 == Content-Length: 374
14:46:10 == Connection: close
14:46:10 == Content-Type: text/html; charset=iso-8859-1
14:46:10 == 
14:46:10 == 
14:46:10 == 
14:46:10 == 503 Service Unavailable
14:46:10 == 
14:46:10 == Service Unavailable
14:46:10 == The server is temporarily unable to service your
14:46:10 == request due to maintenance downtime or capacity
14:46:10 == problems. Please try again later.
14:46:10 == 
14:46:10 == Apache/2.4.29 (Ubuntu) Server at 127.0.0.1 Port 
80
14:46:11 == 
14:46:11 == Connection closed by foreign host.


$ sudo tail /var/log/apache2/error.log 
...
[Tue Feb 18 14:46:05.923939 2020] [mpm_worker:notice] [pid 4982:tid 
139825593654208] AH00297: SIGUSR1 received.  Doing graceful restart
[Tue Feb 18 14:46:05.981362 2020] [mpm_worker:notice] [pid 4982:tid 
139825593654208] AH00292: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/2.7 
configured -- resuming normal operations
[Tue Feb 18 14:46:05.981409 2020] [core:notice] [pid 4982:tid 139825593654208] 
AH00094: Command line: '/usr/sbin/apache2'
[Tue Feb 18 14:46:10.941713 2020] [wsgi:error] [pid 4986:tid 139825361426176] 
(2)No such file or directory: [client 127.0.0.1:37514] mod_wsgi (pid=4986): 
Unable to connect to WSGI daemon process '127.0.0.1' on 
'/var/run/apache2/wsgi.4982.0.1.sock' as user with uid=33.


$ ls -1 /var/run/apache2/wsgi.*.sock
/var/run/apache2/wsgi.4982.1.1.sock


With the fix/patch for Bionic:
---

$ sudo add-apt-repository ppa:mfo/lp1863232v2
$ sudo apt update

$ sudo apt install -y libapache2-mod-wsgi
$ sudo systemctl restart apache2

$ dpkg -s libapache2-mod-wsgi | grep ^Version
Version: 4.5.17-1ubuntu1

Same behavior by default:
---

$ ls -1 /var/run/apache2/wsgi.*.sock
/var/run/apache2/wsgi.6043.0.1.sock

$ sudo systemctl reload apache2

$ ls -1 /var/run/apache2/wsgi.*.sock
/var/run/apache2/wsgi.6043.1.1.sock

$ sudo systemctl reload apache2

$ ls -1 /var/run/apache2/wsgi.*.sock
/var/run/apache2/wsgi.6043.2.1.sock


Now, manually changing it:
---

$ echo 'WSGISocketRotation Off' | sudo tee -a 
/etc/apache2/conf-enabled/wsgi.conf 
$ sudo systemctl restart apache2

Notice name pattern change as in patch. (u33 = UID 33 = www-data:)
And socket file name remains constant:

$ ls -1 /var/run/apache2/wsgi.*.sock
/var/run/apache2/wsgi.6403.u33.1.sock

$ sudo systemctl reload apache2

$ ls -1 /var/run/apache2/wsgi.*.sock
/var/run/apache2/wsgi.6403.u33.1.sock

$ sudo systemctl reload apache2

$ ls -1 

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-18 Thread Mauricio Faria de Oliveira
Hi Dariusz,

I reviewed the debdiffs, they look good overall.

I just had some minor changes to reflect review
practices/comments that I have been thru myself:

- Nice catch on updating the Maintainers field.

- Changelog order of patch file/description:
  I changed to file first, description later,
  as I've seen as more used/standard practice.

- DEP3 headers are present in the .patch; good.

I updated from 'Origin: upstream' to 'backport'
because the patch has a removal of (unneeded)
release notes file. 

Even being uneeded, there were changes to the
upstream patch, so it's no longer clean apply/
cherry pick, thus the change to 'backport',
per Debian DEP-3 spec [1]:

  "backport" (in the case of an upstream patch that had to be modified
to apply on the current version)

I added a '[backport]' section to the .patch
file describing that. (and this other change:)

I also noted that on Xenial there are changes
actually needed to src/server/__init__.py, so
arguably indeed a "true" backport this time.

Oh, and there's a digit missing in Bug-Ubuntu
number, just added that/goes to right URL now.

- Xenial fix on .patch file:

Still on Xenial there's an extra '+'/plus sign
in the commented line added to __init__.py, so
I fixed that one:

   +++#WSGISocketRotation Off

Bionic had that right:

   ++#WSGISocketRotation Off

- Version numbers look good/upgrade path is OK:

- - Versions 4.3.0-1.1ubuntu1 and 4.5.17-1ubuntu1
never existed in package's publishing history [2].

- - Upgrade path is OK in the same release.

$ grep -m2 urgency= x/dput/lp1863232_xenial_mod-wsgi.debdiff 
+mod-wsgi (4.3.0-1.1ubuntu1) xenial; urgency=medium
 mod-wsgi (4.3.0-1.1build1) xenial; urgency=medium

$ dpkg --compare-versions 4.3.0-1.1build1 lt 4.3.0-1.1ubuntu1 ; echo $?
0

$ grep -m2 urgency= b/dput/lp1863232_bionic_mod-wsgi.debdiff 
+mod-wsgi (4.5.17-1ubuntu1) bionic; urgency=medium
 mod-wsgi (4.5.17-1) unstable; urgency=medium

$ dpkg --compare-versions 4.5.17-1 lt 4.5.17-1ubuntu1; echo $?
0

- - Upgrade path is OK across releases (t/x/b/e)

$ rmadison -a source mod-wsgi | grep -e trusty -e eoan
 mod-wsgi | 3.4-4ubuntu2   | trusty   | source
 mod-wsgi | 3.4-4ubuntu2.1.14.04.2 | trusty-security  | source
 mod-wsgi | 3.4-4ubuntu2.1.14.04.2 | trusty-updates   | source
 mod-wsgi | 4.6.5-1| eoan  

$ dpkg --compare-versions 3.4-4ubuntu2.1.14.04.2 lt 4.3.0-1.1ubuntu1 ; echo $?
0

$ dpkg --compare-versions 4.3.0-1.1ubuntu1 lt 4.5.17-1ubuntu1; echo $?
0

$ dpkg --compare-versions 4.5.17-1ubuntu1 lt 4.6.5-1 ; echo $?
0

That's it!

cheers,
Mauricio

[1] https://dep-team.pages.debian.net/deps/dep3/
[2] https://launchpad.net/ubuntu/+source/mod-wsgi/+publishinghistory

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-18 Thread Mauricio Faria de Oliveira
Steps to reproduce/verify on Xenial:
===

References:
- 
https://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html
- 
https://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html#delegation-to-daemon-process
- 
https://github.com/GrahamDumpleton/mod_wsgi/commit/13169f2a0610d7451fae92a414e8e20b91e348c9#diff-3e8b16b2885169dcec2dac843521e12cR29
- 
https://www.howtoforge.com/tutorial/how-to-run-python-scripts-with-apache-and-mod_wsgi-on-ubuntu-18-04/

Create a container with apache2/mod-wsgi in daemon mode,
w/ keep-alive timeout long enough, and wsgi hello-world:
---

$ lxc launch ubuntu:xenial lp1863232x
$ lxc exec lp1863232x -- su - ubuntu

$ sudo apt update
$ sudo apt install -y apache2 libapache2-mod-wsgi

$ sudo sed -i '/^KeepAliveTimeout/ s/ .*/ 15/' /etc/apache2/apache2.conf

$ cat &1 | while read line; do echo "$(date +'%T') == $line"; done
23:34:42 == Trying 127.0.0.1...
23:34:42 == Connected to 127.0.0.1.
23:34:42 == Escape character is '^]'.
23:34:42 == HTTP/1.1 200 OK
23:34:42 == Date: Mon, 17 Feb 2020 23:34:42 GMT
23:34:42 == Server: Apache/2.4.18 (Ubuntu)
23:34:42 == Content-Length: 13
23:34:42 == Keep-Alive: timeout=5, max=100
23:34:42 == Connection: Keep-Alive
23:34:42 == Content-Type: text/plain
23:34:42 == 
23:34:42 == Hello World!
23:34:43 == HTTP/1.1 200 OK
23:34:43 == Date: Mon, 17 Feb 2020 23:34:43 GMT
23:34:43 == Server: Apache/2.4.18 (Ubuntu)
23:34:43 == Content-Length: 13
23:34:43 == Keep-Alive: timeout=5, max=99
23:34:43 == Connection: Keep-Alive
23:34:43 == Content-Type: text/plain
23:34:43 == 
23:34:43 == Hello World!
23:34:58 == Connection closed by foreign host.


Reproduce the problem by placing
'sudo systemctl reload apache2'
between the two HTTP requests
(second request hits Error 503,
depending on apache2 MPM module:
mpm_event/mpm_worker/mpm_prefork)
---

$ lsb_release -cs
xenial

$ dpkg -s libapache2-mod-wsgi | grep ^Version
Version: 4.3.0-1.1build1

For reference on socket filename:

$ sudo systemctl restart apache2

$ ls -1 /var/run/apache2/wsgi.*.sock
/var/run/apache2/wsgi.6244.0.1.sock

$ (cat http-request; sleep 1; sudo systemctl reload apache2; sleep 5; cat 
http-request; sleep 9) | telnet 127.0.0.1 80 2>&1 | while read line; do echo 
"$(date +'%T') == $line"; done
23:48:29 == Trying 127.0.0.1...
23:48:29 == Connected to 127.0.0.1.
23:48:29 == Escape character is '^]'.
23:48:29 == HTTP/1.1 200 OK
23:48:29 == Date: Mon, 17 Feb 2020 23:48:29 GMT
23:48:29 == Server: Apache/2.4.18 (Ubuntu)
23:48:29 == Content-Length: 13
23:48:29 == Keep-Alive: timeout=15, max=100
23:48:29 == Connection: Keep-Alive
23:48:29 == Content-Type: text/plain
23:48:29 == 
23:48:29 == Hello World!
23:48:35 == HTTP/1.1 503 Service Unavailable
23:48:35 == Date: Mon, 17 Feb 2020 23:48:35 GMT
23:48:35 == Server: Apache/2.4.18 (Ubuntu)
23:48:35 == Content-Length: 374
23:48:35 == Connection: close
23:48:35 == Content-Type: text/html; charset=iso-8859-1
23:48:35 == 
23:48:35 == 
23:48:35 == 
23:48:35 == 503 Service Unavailable
23:48:35 == 
23:48:35 == Service Unavailable
23:48:35 == The server is temporarily unable to service your
23:48:35 == request due to maintenance downtime or capacity
23:48:35 == problems. Please try again later.
23:48:35 == 
23:48:35 == Apache/2.4.18 (Ubuntu) Server at 127.0.0.1 Port 
80
23:48:35 == 
23:48:35 == Connection closed by foreign host.

Notice the error log mention socket file name not found:

$ sudo tail /var/log/apache2/error.log 
...
[Mon Feb 17 23:47:43.366910 2020] [mpm_event:notice] [pid 5892:tid 
140660633114496] AH00493: SIGUSR1 received.  Doing graceful restart
[Mon Feb 17 23:47:43.422167 2020] [mpm_event:notice] [pid 5892:tid 
140660633114496] AH00489: Apache/2.4.18 (Ubuntu) mod_wsgi/4.3.0 Python/2.7.12 
configured -- resuming normal operations
[Mon Feb 17 23:47:43.422207 2020] [core:notice] [pid 5892:tid 140660633114496] 
AH00094: Command line: '/usr/sbin/apache2'
[Mon Feb 17 23:47:46.384026 2020] [wsgi:error] [pid 5898:tid 140660447377152] 
(2)No such file or directory: [client 127.0.0.1:33536] mod_wsgi (pid=5898): 
Unable to connect to WSGI daemon process '127.0.0.1' on 
'/var/run/apache2/wsgi.5892.0.1.sock'.

The socket file name has changed:

$ ls -1 /var/run/apache2/wsgi.*.sock
/var/run/apache2/wsgi.6244.1.1.sock


With the fix/patch for Xenial:
---

$ sudo add-apt-repository ppa:mfo/lp1863232v2
$ 

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-18 Thread Mauricio Faria de Oliveira
** Patch added: "lp1863232_bionic_mod-wsgi.debdiff"
   
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+attachment/5329326/+files/lp1863232_bionic_mod-wsgi.debdiff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-18 Thread Mauricio Faria de Oliveira
Dariusz,

As part of my learning homework to be able to
technically review the patch in this proposal,

I came across three things that may be useful
for the bug description/SRU template, so I'll
just add them, if you don't mind.

1) Understanding the scenario where the bug
happens (mod-wsgi running in daemon mode/not
embedded mode, only the former uses sockets;
and reload/not-restart apache2 between HTTP
requests in the same keep-alive connection)
[1, 2].

2) Detailed steps to reproduce/verify the bug.

3) Confirming that the default behavior with
the patch remains as in the previous version
(of course, as it should/is supposed to, but
it's worth mentioning in bug description :-)

With all those points now understood/verified,
I'll proceed with the upload for SRU to B/X.

Thanks!

cheers,
Mauricio

[1] 
https://github.com/GrahamDumpleton/mod_wsgi/commit/13169f2a0610d7451fae92a414e8e20b91e348c9#diff-3e8b16b2885169dcec2dac843521e12cR29
[2] 
https://modwsgi.readthedocs.io/en/develop/user-guides/quick-configuration-guide.html#delegation-to-daemon-process

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-18 Thread Mauricio Faria de Oliveira
** Patch added: "lp1863232_xenial_mod-wsgi.debdiff"
   
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+attachment/5329327/+files/lp1863232_xenial_mod-wsgi.debdiff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-18 Thread Mauricio Faria de Oliveira
Attaching the updated debdiffs for reference.

They build successfully on a PPA for all architectures,
and have been used on steps to reproduce/verify (below.)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-14 Thread Mauricio Faria de Oliveira
** Tags added: sts-sponsor-mfo

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-14 Thread Dariusz Gadomski
SRU proposal for Xenial.

** Description changed:

- On Apache reloads the daemon tries to rotate wsgi sockets causing
- unnecessary log entries, especially in OpenStack context.
+ [Impact]
+ 
+  * Lack of option for disabling wsgi socket rotation leads to errors on 
graceful restarts, making them not as graceful.
+  * This change introduces a new config option WSGISocketRotation that allows 
to disable the rotation.
+ 
+ [Test Case]
+ 
+  * Setup apache2 with mod-wsgi.
+  * Make sure there are some wsgi sockets open.
+  * Reload apache gracefully.
+ 
+ Expected result:
+ No errors related to sockets in the logs
+ 
+ Actual result:
+ There are error messages related to sockets in the logs.
+ 
+ [Regression Potential]
+ 
+  * Since the value is set to On by default any regressions would manifest 
only after explicitly setting it to Off.
+  * After it's set to off WSGI application behavior will change on reloads - 
connections should be resumed instead of cancelled.
+ 
+ [Other Info]
+  
+  * Original bug description:
+ On Apache reloads the WSGI daemon tries to rotate wsgi sockets causing 
unnecessary log entries, especially in OpenStack context.
  
  This has been addressed in mod-wsgi upstream (4.6.0) and could be
  backported to Ubuntu.

** Patch added: "xenial_mod-wsgi_4.3.0-1.1ubuntu1.debdiff"
   
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+attachment/5328184/+files/xenial_mod-wsgi_4.3.0-1.1ubuntu1.debdiff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-14 Thread Dariusz Gadomski
SRU proposal for bionic.

** Patch added: "bionic_mod-wsgi_4.5.17-1ubuntu1.debdiff"
   
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+attachment/5328185/+files/bionic_mod-wsgi_4.5.17-1ubuntu1.debdiff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-14 Thread Dariusz Gadomski
** Tags added: sts

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1863232] Re: daemon rotates socket on restart

2020-02-14 Thread Dariusz Gadomski
Since it is already present upstream it's fixed for focal and eoan.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1863232

Title:
  daemon rotates socket on restart

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mod-wsgi/+bug/1863232/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs