Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track PostgreSQL's changes to stack base access. #67

Merged
merged 1 commit into from
Dec 10, 2015

Conversation

jcflack
Copy link
Contributor

@jcflack jcflack commented Nov 18, 2015

set_stack_base() and restore_stack_base() were added in preference to
direct access to stack_base_ptr (for 9.2, backpatched into 9.1.4,
9.0.8, 8.4.12, and 8.3.19). This adapts PL/Java to that new API so PostgreSQL
doesn't have to keep the old one around forever.

The new style requires miscadmin.h to be included
in those source files that use the STACK_BASE_PUSH / STACK_BASE_POP
macros (there is so much in miscadmin.h, I did not want to add it in
pljava.h and have it processed everywhere).

Also added example ThreadTest.java just to exercise the new logic.
However, if enabled to run from the deployment descriptor, it does
deadlock; apparently PG -> J -> (otherthread PG) works, but the deeper
PG -> J -> PG -> J -> (otherthread PG) does not, and I suspect it's
because of the JNI warning against mispairing bytecode monitorenters with
JNI monitorexits. But that is what the code has done for years now, so
if nothing has been reported, there must not be high demand for that use
pattern.

set_stack_base() and restore_stack_base() were added in preference to
direct access to stack_base_ptr (for 9.2, backpatched into 9.1.4,
9.0.8, 8.4.12, and 8.3.19). They require miscadmin.h to be included
in those source files that use the STACK_BASE_PUSH / STACK_BASE_POP
macros (there is so much in miscadmin.h, I did not want to add it in
pljava.h and have it processed everywhere).

Also added example ThreadTest.java just to exercise the new logic.
However, if enabled to run from the deployment descriptor, it does
deadlock; apparently PG -> J -> (otherthread PG) works, but the deeper
PG -> J -> PG -> J -> (otherthread PG) does not, and I *suspect* it's
because of the JNI warning against mispairing bytecode monitorenters with
JNI monitorexits. But that is what the code has done for years now, so
if nothing has been reported, there must not be high demand for that use
pattern.
jcflack added a commit that referenced this pull request Dec 10, 2015
Track PostgreSQL's changes to stack base access.

Merging after no comments on pull request.
@jcflack jcflack merged commit 200173a into tada:master Dec 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant