public inbox for [email protected]
help / color / mirror / Atom feedomnidb-server: fix for bug 1053100
4+ messages / 2 participants
[nested] [flat]
* omnidb-server: fix for bug 1053100
@ 2024-06-20 06:50 Bradford Boyle <[email protected]>
0 siblings, 1 reply; 4+ messages in thread
From: Bradford Boyle @ 2024-06-20 06:50 UTC (permalink / raw)
To: [email protected]
Hi All,
I have been looking at Debian bug 1053100 (omnidb-server crashes when
creating a new PostgreSQL connection) [1] and I have identified that
this is caused by a change in one of OmniDB's Python dependencies.
OmniDB configures Django's session serialization format to use Python's
`pickle` module instead of the default JSON-based serialization. The
class `Session` has a field `v_databases` that is a dictionary tha
contains references to objects holding information for the various
connections the user has configured. When a connection to a PostgreSQL
database is configured, the `Session` object ends up transitively
referencing an instance of `PGSpecial` from provided by the Python
package `pgspecial`. A recent change in `pgspecial` means that
`PGSpecial` objects are no longer serializable with Python's `pickle`
module.
Reviewing OmniDB's use of `PGSpecial` within its `PostgreSQL` class, it
appears to be a "stateless" in that it does not use the `PGSpecial`
object in any way that would cause its fields to be change value from
when it was constructed. Based on this observation, an approach to
fixing the reported bug is to patch OmniDB's `PostgreSQL` class to omit
`PGSpecial` during serialization and to recreate it during
deserialization. I have a attached a patch that will do this. In my
limited local testing, this fixes the bug. If there are no concerns with
the proposed patch, I can update the package on s.d.o.
It looks like Django 5.x has deprecated `PickleSerializer` [2] so its
unlikely that OmniDB will continue working going forward. At the moment,
Debian testing still provides Django 4.2 but I do not know if the Debian
Python team has plans to update to the newer major version. Independent
of the Django major version incompatibility, it looks like the upstream
repo for OmniDB has gone inactive and the project is unmaintained [3].
Does it make sense to continue publishing packages of OmniDB for newer
releases of Debian and Ubuntu?
-- Bradford
[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1053100
[2]: https://github.com/django/django/pull/15139
[3]: https://github.com/OmniDB/OmniDB
Attachments:
[application/octet-stream] 0001-Customize-PostgreSQL-class-pickle-serialization.patch (1.8K, 2-0001-Customize-PostgreSQL-class-pickle-serialization.patch)
download | inline diff:
From 6a46c1068bf90faaf3b73024e8c48b04899a8e97 Mon Sep 17 00:00:00 2001
From: "Bradford D. Boyle" <[email protected]>
Date: Sun, 12 May 2024 20:39:07 -0700
Subject: [PATCH] Customize PostgreSQL class pickle serialization
This commit modifies PostgreSQL to omit v_special when pickling. OmniDB
is configured to use django's PickleSerializer but Python's pickle
module can only serialize functions that are accessible from the
top-level of a module. Newer version's of pgspecial use an inner
function when creating SpecialCommands. This causes an AttributeError to
be thrown with the following message:
AttributeError: Can't pickle local object
'show_extra_help_command.<locals>.placeholder'
When an instance of PostgreSQL is deserialized, v_special is recreated.
This approach works since v_special is only read and isn't modified.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1053100
https://docs.python.org/3/library/pickle.html#what-can-be-pickled-and-unpickled
---
OmniDB/OmniDB_app/include/Spartacus/Database.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/OmniDB/OmniDB_app/include/Spartacus/Database.py b/OmniDB/OmniDB_app/include/Spartacus/Database.py
index a41281bc..4ec25a08 100644
--- a/OmniDB/OmniDB_app/include/Spartacus/Database.py
+++ b/OmniDB/OmniDB_app/include/Spartacus/Database.py
@@ -1859,6 +1859,16 @@ class PostgreSQL(Generic):
if not v_keep:
self.Close()
+ def __getstate__(self):
+ state = self.__dict__.copy()
+ # don't pickle 'v_special'
+ del state["v_special"]
+ return state
+
+ def __setstate__(self, state):
+ self.__dict__.update(state)
+ # add 'v_special' back since it doesn't exist in the pickle
+ self.v_special = PGSpecial()
'''
------------------------------------------------------------------------
--
2.45.2
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: omnidb-server: fix for bug 1053100
@ 2024-06-20 09:26 Christoph Berg <[email protected]>
parent: Bradford Boyle <[email protected]>
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Berg @ 2024-06-20 09:26 UTC (permalink / raw)
To: Bradford Boyle <[email protected]>; +Cc: [email protected]
Re: Bradford Boyle
> I have been looking at Debian bug 1053100 (omnidb-server crashes when
> creating a new PostgreSQL connection) [1] and I have identified that
> this is caused by a change in one of OmniDB's Python dependencies.
Hi Bradford,
thanks for the debugging! I have not had any time to spend on OmniDB,
so this is most welcome.
> It looks like Django 5.x has deprecated `PickleSerializer` [2] so its
> unlikely that OmniDB will continue working going forward. At the moment,
> Debian testing still provides Django 4.2 but I do not know if the Debian
> Python team has plans to update to the newer major version. Independent
> of the Django major version incompatibility, it looks like the upstream
> repo for OmniDB has gone inactive and the project is unmaintained [3].
> Does it make sense to continue publishing packages of OmniDB for newer
> releases of Debian and Ubuntu?
I spoke to some of the 2ndQuandrant, err, EDB people at pgconf.eu last
year and they confirmed OmniDB is practically dead. Which is a pity,
because I had picked that as a pgadmin4 replacement :(.
If your patch fixes the problem, we should apply it. Hopefully that
will make OmniDB work at least for now, perhaps even for trixie. But
after that, I have little hope, and we shouldn't put too much more
(non-trivial) effort into it since the horse seems to be dead :(.
Christoph
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: omnidb-server: fix for bug 1053100
@ 2024-06-24 00:46 Bradford Boyle <[email protected]>
parent: Christoph Berg <[email protected]>
0 siblings, 1 reply; 4+ messages in thread
From: Bradford Boyle @ 2024-06-24 00:46 UTC (permalink / raw)
To: Christoph Berg <[email protected]>; +Cc: [email protected]
Hi Christoph,
I've pushed two fixes for omnidb to Salsa:
1. A fix for 1053100
2. Replacing a deprecated Django API to get the package working with
Debian trixie
I've triggered a snapshot build on pgdgbuild and manually tested the
artifacts on both bookworm and trixie. I'd like to request a review and
upload, as cycles permit.
Let me know if anything needs changes.
-- Bradford
[1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1053100
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: omnidb-server: fix for bug 1053100
@ 2024-06-24 08:59 Christoph Berg <[email protected]>
parent: Bradford Boyle <[email protected]>
0 siblings, 0 replies; 4+ messages in thread
From: Christoph Berg @ 2024-06-24 08:59 UTC (permalink / raw)
To: Bradford Boyle <[email protected]>; +Cc: [email protected]
Re: Bradford Boyle
> I've pushed two fixes for omnidb to Salsa:
>
> 1. A fix for 1053100
> 2. Replacing a deprecated Django API to get the package working with
> Debian trixie
Hi Bradford,
thanks!
I've been dabbling with django for some other hobby projects and had
seen some warnings around the url() functions, but not checked out any
details. That will be useful there too.
> I've triggered a snapshot build on pgdgbuild and manually tested the
> artifacts on both bookworm and trixie. I'd like to request a review and
> upload, as cycles permit.
Perfect, as always! Uploading shortly.
Christoph
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2024-06-24 08:59 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-06-20 06:50 omnidb-server: fix for bug 1053100 Bradford Boyle <[email protected]>
2024-06-20 09:26 ` Christoph Berg <[email protected]>
2024-06-24 00:46 ` Bradford Boyle <[email protected]>
2024-06-24 08:59 ` Christoph Berg <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox