launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #31919
[Merge] ~ines-almeida/launchpad:remove-meliae into launchpad:master
Ines Almeida has proposed merging ~ines-almeida/launchpad:remove-meliae into launchpad:master.
Commit message:
Remove meliae dependency
This is an unmaintained dependency that adds a feature to send a signal to dump information when LP is using an unreasonable amount of memory.
This feature hasn't been used by any of the devs and is not compatible with newer versions of Python
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~ines-almeida/launchpad/+git/launchpad/+merge/477421
Ran all tests that contain the word `librarian` successfully
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~ines-almeida/launchpad:remove-meliae into launchpad:master.
diff --git a/daemons/librarian.tac b/daemons/librarian.tac
index 4522b9c..151f734 100644
--- a/daemons/librarian.tac
+++ b/daemons/librarian.tac
@@ -5,7 +5,6 @@
# Use with "twistd2.4 -y <file.tac>", e.g. "twistd -noy server.tac"
import os
-import signal
# Turn off the http_proxy environment variable if it is set. We
# don't need it, but we do need to contact Keystone & Swift directly.
@@ -16,7 +15,6 @@ if "http_proxy" in os.environ:
if "HTTP_PROXY" in os.environ:
del os.environ["HTTP_PROXY"]
-from meliae import scanner
from twisted.application import service, strports
from twisted.internet import reactor
from twisted.python import log
@@ -25,7 +23,6 @@ from twisted.web import server
from lp.services.config import config, dbconfig
from lp.services.daemons import readyservice
-from lp.services.librarian.interfaces.client import DUMP_FILE, SIGDUMPMEM
from lp.services.librarianserver import db, storage
from lp.services.librarianserver import web as fatweb
from lp.services.librarianserver.libraryprotocol import FileUploadFactory
@@ -125,11 +122,3 @@ options.parseOptions()
logfile = options.get("logfile")
observer = set_up_oops_reporting("librarian", "librarian", logfile)
application.addComponent(observer, ignoreClass=1)
-
-
-# Setup a signal handler to dump the process' memory upon 'kill -44'.
-def sigdumpmem_handler(signum, frame):
- scanner.dump_all_objects(DUMP_FILE)
-
-
-signal.signal(SIGDUMPMEM, sigdumpmem_handler)
diff --git a/lib/lp/services/librarian/interfaces/client.py b/lib/lp/services/librarian/interfaces/client.py
index a3b7232..985433f 100644
--- a/lib/lp/services/librarian/interfaces/client.py
+++ b/lib/lp/services/librarian/interfaces/client.py
@@ -13,14 +13,10 @@ __all__ = [
]
import http.client
-import signal
from lazr.restful.declarations import error_status
from zope.interface import Interface
-SIGDUMPMEM = signal.SIGRTMIN + 10
-DUMP_FILE = "/tmp/librarian-memory.dump"
-
class LibrarianFailure(Exception):
"""Base class for failures trying to use the libararian."""
diff --git a/lib/lp/services/librarianserver/tests/test_sigdumpmem.py b/lib/lp/services/librarianserver/tests/test_sigdumpmem.py
deleted file mode 100644
index 6434dc3..0000000
--- a/lib/lp/services/librarianserver/tests/test_sigdumpmem.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Test the SIGDUMPMEM signal handler."""
-
-import os
-import time
-
-from lp.services.librarian.interfaces.client import DUMP_FILE, SIGDUMPMEM
-from lp.testing import TestCase
-from lp.testing.layers import LibrarianLayer
-
-
-class SIGDUMPMEMTestCase(TestCase):
- layer = LibrarianLayer
-
- def test_sigdumpmem(self):
- # Remove the dump file, if one exists.
- if os.path.exists(DUMP_FILE):
- os.unlink(DUMP_FILE)
- self.assertFalse(os.path.exists(DUMP_FILE))
-
- # Use the global instance used by the Layer machinery
- pid = LibrarianLayer.librarian_fixture.pid
-
- # Send the signal and ensure the dump file is created.
- os.kill(pid, SIGDUMPMEM)
- timeout = 5
- start_time = time.time()
- while time.time() < start_time + timeout:
- if os.path.exists(DUMP_FILE):
- break
- self.assertTrue(os.path.exists(DUMP_FILE))
diff --git a/lib/lp/services/webapp/configure.zcml b/lib/lp/services/webapp/configure.zcml
index 5b61d74..47e7116 100644
--- a/lib/lp/services/webapp/configure.zcml
+++ b/lib/lp/services/webapp/configure.zcml
@@ -282,12 +282,6 @@
class="lp.services.webapp.notifications.NotificationTestView4"
/>
- <!-- Signal handlers -->
- <subscriber
- for="zope.processlifetime.IProcessStarting"
- handler="lp.services.webapp.sigdumpmem.setup_sigdumpmem"
- />
-
<!-- Set the default timeout function. -->
<subscriber
for="zope.processlifetime.IProcessStarting"
diff --git a/lib/lp/services/webapp/sigdumpmem.py b/lib/lp/services/webapp/sigdumpmem.py
deleted file mode 100644
index 0b4d4e8..0000000
--- a/lib/lp/services/webapp/sigdumpmem.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-import signal
-
-from meliae import scanner
-
-SIGDUMPMEM = signal.SIGRTMIN + 10
-DUMP_FILE = "/tmp/launchpad-memory.dump"
-
-
-def sigdumpmem_handler(signum, frame):
- scanner.dump_all_objects(DUMP_FILE)
-
-
-def setup_sigdumpmem(event):
- signal.signal(SIGDUMPMEM, sigdumpmem_handler)
diff --git a/lib/lp/services/webapp/tests/test_sigdumpmem.py b/lib/lp/services/webapp/tests/test_sigdumpmem.py
deleted file mode 100644
index 89f8766..0000000
--- a/lib/lp/services/webapp/tests/test_sigdumpmem.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Test the SIGDUMPMEM signal handler."""
-
-import os
-import time
-
-from lp.services.config import config
-from lp.services.pidfile import get_pid
-from lp.services.webapp.sigdumpmem import DUMP_FILE, SIGDUMPMEM
-from lp.testing import TestCase
-from lp.testing.layers import AppServerLayer
-
-
-class SIGDUMPMEMTestCase(TestCase):
- layer = AppServerLayer
-
- def test_sigdumpmem(self):
- # XXX: AaronBentley 2010-04-07 bug=557356: Test breaks other tests.
- return
- # Remove the dump file, if one exists.
- if os.path.exists(DUMP_FILE):
- os.unlink(DUMP_FILE)
- self.assertFalse(os.path.exists(DUMP_FILE))
-
- # Get the pid for the process spawned by the AppServerLayer, which is
- # the one we'll be sending the signal to.
- orig_instance_name = config.instance_name
- config.setInstance("testrunner-appserver")
- pid = get_pid("launchpad")
- config.setInstance(orig_instance_name)
-
- # Send the signal and ensure the dump file is created.
- os.kill(pid, SIGDUMPMEM)
- timeout = 10
- start_time = time.time()
- while time.time() < start_time + timeout:
- if os.path.exists(DUMP_FILE):
- break
- self.assertTrue(os.path.exists(DUMP_FILE))
diff --git a/requirements/launchpad.txt b/requirements/launchpad.txt
index 90ce23d..b9ebcae 100644
--- a/requirements/launchpad.txt
+++ b/requirements/launchpad.txt
@@ -90,7 +90,6 @@ m2r==0.1.13
Markdown==3.2.2
martian==1.3.post1
maxminddb==1.5.1
-meliae==0.5.1
mistune==0.8.3
monotonic==1.5
more-itertools==10.5.0
diff --git a/setup.cfg b/setup.cfg
index a08e2f0..abcab52 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -54,7 +54,6 @@ install_requires =
lpjsmin
lxml[cssselect]
Markdown
- meliae
multipart
oauth
oauthlib