Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

PostgreSQL crashes with java based UDF functions



PostgreSQL 9.4.7 database system crashes when executing SQL queries using pr_read_from_stream, the Java based User-Defined function.

Error Messages

The JVM crash hs_log_pid log file contains the following text:

SIGBUS (0x7) at pc=0x00007f0a8b13fb98, pid=2082, tid=139684070221888

JRE version:  (8.0_60-b27) (build )
Java VM: OpenJDK 64-Bit Server VM (25.60-b23 mixed mode linux-amd64 compressed oops)
Problematic frame:
j  java.lang.Object.<clinit>()V+0

---------------  S Y S T E M  ---------------
OS:Red Hat Enterprise Linux Server release 7.1 (Maipo)
uname: Linux 3.10.0-514.21.2.el7.x86_64 #1 SMP x86_64

The following query caused the JVM crash:

DETAIL:  Failed process was running: SELECT "PC0"."pyid" AS "pyID" , "PC0"."pylabel" AS "pyLabel" , "PC0"."pxurgencywork" AS "pxUrgencyWork" , "PC0"."pystatuswork" AS "pyStatusWork" , "PC0"."pxcreateopname" AS "pxCreateOpName" , "PC0"."pxcreatedatetime" AS "pxCreateDateTime" , "PC0"."pxupdateopname" AS "pxUpdateOpName" , "PC0"."pxupdatedatetime" AS "pxUpdateDateTime" , "PC0"."pxobjclass" AS "pxObjClass" , "PC0"."pzinskey" AS "pzInsKey" FROM data.MyCO_Work "PC0" WHERE ("PC0"."pylabel" IS NOT NULL AND  data.pr_read_from_stream('.pyOwner', "PC0".pzInsKey, "PC0".pzPVStream) LIKE $1)  AND  "PC0"."pxobjclass" LIKE $2

Steps to Reproduce

Execute SQL statements using Java based UDFs.

Root Cause

A defect or configuration issue in the operating environment.
The JVM error above is a symptom of a Linux Kernel bug which introduced to solve the the Stack Guard defect (CVE-2017-1000364)
RedHat Solution, 'JVM crashes after updating to the kernel with the patch for Stack Guard flaw (CVE-2017-1000364)', pointed to the same kernel version reported in the JVM crash file provided (Linux 3.10.0-514.21.2.el7.x86_64)

The same scenario is documented in the following OpenJDK bugs: 



Make the following change to the operating environment:

Upgrade the Linux Kernel (the issue is resolved since kernel-3.10.0-514.26.2.el7.x86_64).

Alternatively, increase the thread stack size of the JVM using -Xss2m argument.

That is, in the PostgreSQL Server case, add the -Xss2M  to the pljava.vmoptions property defined in the postgresql.conf configuration file placed in the PostgreSQL data directory.

For example,

pljava.vmoptions = '-Xms32M -Xmx64M -Xss2M -XX:ParallelGCThreads=2'

Published March 23, 2019 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us