pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feed[pgjdbc/pgjdbc] issue #3902: createBlob() not closing LargeObject.
6+ messages / 3 participants
[nested] [flat]
* [pgjdbc/pgjdbc] issue #3902: createBlob() not closing LargeObject.
@ 2025-12-31 10:28 "batman007db (@batman007db)" <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: batman007db (@batman007db) @ 2025-12-31 10:28 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
**Describe the issue**
So the "setBlob()" method consumes some direct memory but then doesnt release it? Asking this because the "setBlob()" internally calls "createBlob()" and in it a "LargeObject" is created and opened (through "open()) but then not closed? So i think that LargeObject is not closed.
**Driver Version?**
42.7.3
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3902: createBlob() not closing LargeObject.
@ 2025-12-31 12:08 ` "davecramer (@davecramer)" <[email protected]>
4 siblings, 0 replies; 6+ messages in thread
From: davecramer (@davecramer) @ 2025-12-31 12:08 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
OutputStreams are closable so in the try with resources it will be closed
https://github.com/pgjdbc/pgjdbc/blob/e3ea9a3bfce6330aea67b3ff555cd7c32a755134/pgjdbc/src/main/java/...
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3902: createBlob() not closing LargeObject.
@ 2026-01-01 07:40 ` "batman007db (@batman007db)" <[email protected]>
4 siblings, 0 replies; 6+ messages in thread
From: batman007db (@batman007db) @ 2026-01-01 07:40 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
Cool. but when i tried java profiling in jconsole, the direct memory increases by a specific amount when ```setBlob()``` was called and then that memory wasnt getting released. Is there anything that I am missing? like after how long is the direct memory released or something else?. If needed i can provided the jconsole's direct memory graph usage from my application.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3902: createBlob() not closing LargeObject.
@ 2026-01-01 11:34 ` "davecramer (@davecramer)" <[email protected]>
4 siblings, 0 replies; 6+ messages in thread
From: davecramer (@davecramer) @ 2026-01-01 11:34 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
Can you share the profile information?
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3902: createBlob() not closing LargeObject.
@ 2026-01-02 14:15 ` "davecramer (@davecramer)" <[email protected]>
4 siblings, 0 replies; 6+ messages in thread
From: davecramer (@davecramer) @ 2026-01-02 14:15 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
So there's a point where we probably leave the blob outputstream open due to an infinite loop. The best we can do is set it to null and wait for the GC to recover the memory
https://github.com/pgjdbc/pgjdbc/blob/e3ea9a3bfce6330aea67b3ff555cd7c32a755134/pgjdbc/src/main/java/...
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: [pgjdbc/pgjdbc] issue #3902: createBlob() not closing LargeObject.
@ 2026-01-02 20:19 ` "vlsi (@vlsi)" <[email protected]>
4 siblings, 0 replies; 6+ messages in thread
From: vlsi (@vlsi) @ 2026-01-02 20:19 UTC (permalink / raw)
To: pgjdbc/pgjdbc <[email protected]>
@batman007db , it would be great if you could share the profiling you have.
If you can reproduce the behavior with a simpler example, it would help as well.
---
> profiling in jconsole, the direct memory increases
As far as I understand, it should not be connected with pgjdbc. I do not think pgjdbc uses direct memory at the moment.
---
You could use https://github.com/async-profiler/async-profiler to profile nativememory via `event=nativemem`. See https://github.com/async-profiler/async-profiler/blob/master/docs/ProfilerOptions.md
---
Here we should use try-with-resources for `LargeObject` as well: https://github.com/pgjdbc/pgjdbc/blob/62c9805ef8606f3d38273ac69f64b14e936a0bfa/pgjdbc/src/main/java/...
I think the intention was "ok, we intend to use the blob as prepared statement sometime later.
However, in practice closing the lob (calling `lo_close` API) does not invalidate large object oid, and it just releases a server-side handle.
I guess we should better close the handle anyway as we do not access the lob after we create and populate it.
However, I do not think it would impact "direct memory increases".
---
@batman007db , it would be great if you could try moving `LargeObject` into try as follows (I have not tried it yet, however, it looks safe):
```java
try (LargeObject lob = lom.open(oid);
OutputStream outputStream = lob.getOutputStream()) {
```
However, I do not think it would impact your case though.
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2026-01-02 20:19 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-12-31 10:28 [pgjdbc/pgjdbc] issue #3902: createBlob() not closing LargeObject. "batman007db (@batman007db)" <[email protected]>
2025-12-31 12:08 ` "davecramer (@davecramer)" <[email protected]>
2026-01-01 07:40 ` "batman007db (@batman007db)" <[email protected]>
2026-01-01 11:34 ` "davecramer (@davecramer)" <[email protected]>
2026-01-02 14:15 ` "davecramer (@davecramer)" <[email protected]>
2026-01-02 20:19 ` "vlsi (@vlsi)" <[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