Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#795 closed defect (fixed)

Connection closed on parallel WCS requests when one query fails

Reported by: pcampalani Owned by: dmisev
Priority: major Milestone: 9.0.x
Component: petascope Version: development
Keywords: parallel psql exception Cc: damiano, dmisev, mantovani, pbaumann
Complexity: Medium


There is a thread-safety issue in the handling of Postgres connections that is revealed when due parallel queries are run, but one of them fails (by requesting a non-existent coverage).

I tried sending N requests in parallel, half of them with wrong coverage ID:

$ declare -a URLLIST=(\
  'http://localhost:8080/rasdaman/ows/wcs2?service=WCS&version=2.0.1&request=GetCoverage&coverageId=irr_cube_scam&subset=E(80000,100000)&subset=N(5100000,5124000)&subset=ansi(148654)&scaleextent=E(0:0)' \
for i in {0..10}; do ( (( $i % 2 ==  0)); wget ${URLLIST[$?]} -O out${i}.xml &) ; done

(thanks MEEO Srl for reporting), it happens that a closed connection is trying to get used:

ERROR [14:05:29] DbMetadataSource@1324: Failed reading the coverage metadata
org.postgresql.util.PSQLException: This connection has been closed.
    at petascope.util.WcsUtil.getMetadata(
    at petascope.wcs2.parsers.GetCoverageMetadata.<init>(
    at petascope.wcs2.extensions.GmlFormatExtension.handle(
    at petascope.wcs2.handlers.GetCoverageHandler.handle(

I tried up to 20 queries but can't reproduce it.

Apparently this affect v9.0.2 only, while v9.0.1 is still ok.
I wonder if changeset:216edb0 ('ticket:713 - fix database connection leaks in petascope') has some responsibility here or not.

Change History (15)

comment:1 Changed 3 years ago by damiano

  • Cc mantovani added

comment:2 Changed 3 years ago by dmisev

  • Owner changed from pcampalani to dmisev
  • Status changed from new to assigned

comment:3 Changed 3 years ago by dmisev

Damiano, you have postgresql 8.4?

comment:4 Changed 3 years ago by damiano


comment:5 Changed 3 years ago by dmisev

Can't reproduce it either. How did you test Damiano?

comment:6 Changed 3 years ago by dmisev

  • Cc pbaumann added

I submitted a patch fix

comment:7 Changed 3 years ago by mantovani

are you going to build and realease the 9.0.3 RPM package?

comment:8 Changed 3 years ago by dmisev

Once the patch is applied, yes. If it's urgent you could easily build the petascope war, I don't have a VM with Java 6 at the moment.

comment:9 Changed 3 years ago by mantovani

It is urgent and, you know, our update/upgrade process is based on RPM packages: the sooner you build them, the better it is

comment:10 Changed 3 years ago by dmisev

Yes I understand that. I'm sure Peter will soon check and apply the patch.

comment:11 Changed 3 years ago by mantovani


comment:12 Changed 3 years ago by pbaumann

at OGC TC meeting. Can do on Monday.

comment:13 Changed 3 years ago by mantovani

fine with me. Enjoy your OGC meeting.

comment:14 Changed 3 years ago by dmisev

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:15 Changed 3 years ago by damiano

I can confirm that the issue is fixed
New petascope rpm (9.0.3) works fine


Note: See TracTickets for help on using tickets.