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

Build issue with 1.6.3 on Postgres PRO EE 13 #376

Open
DobryDobry opened this issue Oct 28, 2021 · 5 comments
Open

Build issue with 1.6.3 on Postgres PRO EE 13 #376

DobryDobry opened this issue Oct 28, 2021 · 5 comments

Comments

@DobryDobry
Copy link

Hi! Do you have any ideas?

$ java -version
openjdk version "17.0.1" 2021-10-19 LTS
OpenJDK Runtime Environment (build 17.0.1+12-LTS)
OpenJDK 64-Bit Server VM (build 17.0.1+12-LTS, mixed mode, sharing)

$ javac -version
javac 17.0.1

$ mvn -version
Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739)
Maven home: /home/sysadmin/pg_pljava_extension/apache-maven-3.8.3
Java version: 17.0.1, vendor: BellSoft, runtime: /usr/lib/jvm/bellsoft-java17-amd64
Default locale: ru_RU, platform encoding: UTF-8
OS name: "linux", version: "4.15.3-141-generic", arch: "amd64", family: "unix"

$ gcc --version
gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516

OS: Astra Linux CE 2.12
DB: Postgres PRO EE 13
PL/Java: 1.6.3



$ mvn -X -Pwnosign clean install

................
[INFO] --- pljava-pgxs:1.6.3:scripted-goal (build-shared-object) @ pljava-so ---
................
[INFO] Using compiling/linking rules for Linux
In file included from /opt/pgpro/ent-13/include/server/postgres.h:47:0,
                 from /home/sysadmin/pg_pljava_extension/pljava-1_6_3/pljava-so/src/main/c/PgSavepoint.c:13:
/home/sysadmin/pg_pljava_extension/pljava-1_6_3/pljava-so/src/main/c/PgSavepoint.c: In function ‘PgSavepoint_initialize’:
/opt/pgpro/ent-13/include/server/c.h:914:7: error: static assertion failed: "SubTransactionId wider than jint?!"
  do { _Static_assert(condition, errmessage); } while(0)
       ^
/home/sysadmin/pg_pljava_extension/pljava-1_6_3/pljava-so/src/main/c/PgSavepoint.c:88:2: note: in expansion of macro ‘StaticAssertStmt’
  StaticAssertStmt(sizeof(SubTransactionId) <= sizeof(jint),
  ^~~~~~~~~~~~~~~~
/home/sysadmin/pg_pljava_extension/pljava-1_6_3/pljava-so/src/main/c/XactListener.c: In function ‘xactCB’:
/home/sysadmin/pg_pljava_extension/pljava-1_6_3/pljava-so/src/main/c/XactListener.c:37:2: warning: enumeration value ‘XACT_EVENT_START’ not handled in switch [-Wswitch]
  switch(event)
  ^~~~~~
/home/sysadmin/pg_pljava_extension/pljava-1_6_3/pljava-so/src/main/c/XactListener.c:37:2: warning: enumeration value ‘XACT_EVENT_COMMIT_COMMAND’ not handled in switch [-Wswitch]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for PostgreSQL PL/Java 1.6.3:
[INFO]
[INFO] PostgreSQL PL/Java ................................. SUCCESS [  1.204 s]
[INFO] PL/Java API ........................................ SUCCESS [  4.331 s]
[INFO] PL/Java backend Java code .......................... SUCCESS [  3.468 s]
[INFO] PL/Java PGXS ....................................... SUCCESS [  4.791 s]
[INFO] PL/Java backend native code ........................ FAILURE [ 11.796 s]
[INFO] PL/Java Ant tasks .................................. SKIPPED
[INFO] PL/Java examples ................................... SKIPPED
[INFO] PL/Java packaging .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  25.721 s
[INFO] Finished at: 2021-10-28T13:31:01+03:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "wnosign" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.postgresql:pljava-pgxs:1.6.3:scripted-goal (build-shared-object) on project pljava-so: Compilation failed with exit code: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.postgresql:pljava-pgxs:1.6.3:scripted-goal (build-shared-object) on project pljava-so: Compilation failed with exit code: 1
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoFailureException: Compilation failed with exit code: 1
    at org.postgresql.pljava.pgxs.ScriptingMojo.exceptionWrap (ScriptingMojo.java:177)
    at com.oracle.truffle.polyglot.HostMethodDesc$SingleMethod$MHBase.invokeHandle (HostMethodDesc.java:297)
    at com.oracle.truffle.polyglot.HostMethodDesc$SingleMethod$MHBase$1.executeImpl (HostMethodDesc.java:332)
    at com.oracle.truffle.polyglot.GuestToHostRootNode.execute (GuestToHostRootNode.java:87)
    at com.oracle.truffle.api.impl.DefaultCallTarget.callDirectOrIndirect (DefaultCallTarget.java:85)
    at com.oracle.truffle.api.impl.DefaultCallTarget$1.call (DefaultCallTarget.java:123)
    at com.oracle.truffle.polyglot.GuestToHostRootNode.guestToHostCall (GuestToHostRootNode.java:113)
    at com.oracle.truffle.polyglot.HostMethodDesc$SingleMethod$MHBase.invokeGuestToHost (HostMethodDesc.java:322)
    at com.oracle.truffle.polyglot.HostExecuteNode.doInvoke (HostExecuteNode.java:799)
    at com.oracle.truffle.polyglot.HostExecuteNode.doFixed (HostExecuteNode.java:128)
    at com.oracle.truffle.polyglot.HostExecuteNodeGen.executeAndSpecialize (HostExecuteNodeGen.java:141)
    at com.oracle.truffle.polyglot.HostExecuteNodeGen.execute (HostExecuteNodeGen.java:98)
    at com.oracle.truffle.polyglot.HostObject.invokeMember (HostObject.java:388)
    at com.oracle.truffle.polyglot.HostObjectGen$InteropLibraryExports$Cached.invokeMemberNode_AndSpecialize (HostObjectGen.java:1314)
    at com.oracle.truffle.polyglot.HostObjectGen$InteropLibraryExports$Cached.invokeMember (HostObjectGen.java:1289)
    at com.oracle.truffle.api.interop.InteropLibraryGen$CachedDispatch.invokeMember (InteropLibraryGen.java:4871)
    at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$ForeignInvokeNode.executeCall (JSFunctionCallNode.java:1479)
    at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeAndSpecialize (JSFunctionCallNode.java:294)
    at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall (JSFunctionCallNode.java:240)
    at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$InvokeNode.execute (JSFunctionCallNode.java:722)
    at com.oracle.truffle.js.nodes.access.JSWriteCurrentFrameSlotNodeGen.execute_generic4 (JSWriteCurrentFrameSlotNodeGen.java:177)
    at com.oracle.truffle.js.nodes.access.JSWriteCurrentFrameSlotNodeGen.execute (JSWriteCurrentFrameSlotNodeGen.java:93)
    at com.oracle.truffle.js.nodes.access.JSWriteCurrentFrameSlotNodeGen.executeVoid (JSWriteCurrentFrameSlotNodeGen.java:343)
    at com.oracle.truffle.js.nodes.control.ReturnNode$FrameReturnNode.executeVoid (ReturnNode.java:152)
    at com.oracle.truffle.js.nodes.control.IfNode.executeVoid (IfNode.java:181)
    at com.oracle.truffle.js.nodes.control.AbstractBlockNode.executeVoid (AbstractBlockNode.java:91)
    at com.oracle.truffle.js.nodes.control.AbstractBlockNode.execute (AbstractBlockNode.java:84)
    at com.oracle.truffle.js.nodes.control.TryCatchNode.execute (TryCatchNode.java:141)
    at com.oracle.truffle.js.nodes.control.ReturnTargetNode$FrameReturnTargetNode.execute (ReturnTargetNode.java:124)
    at com.oracle.truffle.js.nodes.function.FunctionBodyNode.execute (FunctionBodyNode.java:73)
    at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm (FunctionRootNode.java:147)
    at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute (JavaScriptRealmBoundaryRootNode.java:93)
    at com.oracle.truffle.api.impl.DefaultCallTarget.callDirectOrIndirect (DefaultCallTarget.java:85)
    at com.oracle.truffle.api.impl.DefaultDirectCallNode.call (DefaultDirectCallNode.java:59)
    at com.oracle.truffle.js.nodes.function.JSFunctionCallNode$UnboundJSFunctionCacheNode.executeCall (JSFunctionCallNode.java:1266)
    at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeAndSpecialize (JSFunctionCallNode.java:294)
    at com.oracle.truffle.js.nodes.function.JSFunctionCallNode.executeCall (JSFunctionCallNode.java:240)
    at com.oracle.truffle.js.nodes.interop.JSInteropInvokeNode.doCached (JSInteropInvokeNode.java:86)
    at com.oracle.truffle.js.nodes.interop.JSInteropInvokeNodeGen.executeAndSpecialize (JSInteropInvokeNodeGen.java:103)
    at com.oracle.truffle.js.nodes.interop.JSInteropInvokeNodeGen.execute (JSInteropInvokeNodeGen.java:61)
    at com.oracle.truffle.js.runtime.builtins.JSClass.invokeMember (JSClass.java:776)
    at com.oracle.truffle.js.runtime.builtins.JSClassGen$InteropLibraryExports$Cached.invokeMemberNode_AndSpecialize (JSClassGen.java:898)
    at com.oracle.truffle.js.runtime.builtins.JSClassGen$InteropLibraryExports$Cached.invokeMember (JSClassGen.java:874)
    at com.oracle.truffle.polyglot.ProxyInvokeNode.invokeOrExecute (HostInteropReflect.java:608)
    at com.oracle.truffle.polyglot.ProxyInvokeNode.doCachedMethod (HostInteropReflect.java:592)
    at com.oracle.truffle.polyglot.ProxyInvokeNodeGen.executeAndSpecialize (ProxyInvokeNodeGen.java:116)
    at com.oracle.truffle.polyglot.ProxyInvokeNodeGen.execute (ProxyInvokeNodeGen.java:64)
    at com.oracle.truffle.polyglot.ObjectProxyNode.executeImpl (HostInteropReflect.java:535)
    at com.oracle.truffle.polyglot.HostToGuestRootNode.execute (HostToGuestRootNode.java:99)
    at com.oracle.truffle.api.impl.DefaultCallTarget.call (DefaultCallTarget.java:102)
    at com.oracle.truffle.polyglot.ObjectProxyHandler.invoke (HostInteropReflect.java:678)
    at jdk.proxy6.$Proxy46.execute (Unknown Source)
    at org.postgresql.pljava.pgxs.ScriptingMojo.execute (ScriptingMojo.java:84)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:972)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :pljava-so

@jcflack jcflack changed the title Build issue with 1.6.3 Build issue with 1.6.3 on Postgres PRO EE 13 Oct 28, 2021
@jcflack
Copy link
Contributor

jcflack commented Oct 28, 2021

StaticAssertStmt(sizeof(SubTransactionId) <= sizeof(jint), ...)

Well that's peculiar. In the community PostgreSQL 13, SubTransactionId is a typedef for uint32. It is still uint32 even in community PostgreSQL 14.

Has Postgres PRO EE 13 redefined it to a wider type? Can you check how it is defined in /opt/pgpro/ent-13/include/server/c.h ?

The Java jint type shouldn't have changed; that is fixed at 32 bits in the Java Language Specification.

So it seems either PostgresPRO must have increased the width of SubTransactionId, or the C compiler is getting sizeof or StaticAssertStmt wrong, or there is some kind of header file confusion going on.

@DobryDobry
Copy link
Author

Thanks for your answer.

Has Postgres PRO EE 13 redefined it to a wider type? Can you check how it is defined in /opt/pgpro/ent-13/include/server/c.h ?

Yes, you are right. In /opt/pgpro/ent-13/include/server/c.h i found:

typedef uint32 ShortTransactionId;
typedef uint64 LocalTransactionId;
typedef uint64 SubTransactionId;

What can i do with it?

@jcflack
Copy link
Contributor

jcflack commented Oct 28, 2021

It won't be completely trivial, as it will require corresponding changes in some of the C and Java code of PL/Java.I should review what the PL/Java subtransaction listener API currently exposes, to make sure a change doesn't break existing users' code.

Related discussion opened on pgsql-hackers.

@jcflack
Copy link
Contributor

jcflack commented Nov 24, 2021

I am getting back to this issue. Would you be able to look in the Postgres Pro include/access/xact.h file and confirm that it still has the same function prototypes for these functions?

extern SubTransactionId GetCurrentSubTransactionId(void);
...
extern void BeginInternalSubTransaction(const char *name);
extern void ReleaseCurrentSubTransaction(void);
extern void RollbackAndReleaseCurrentSubTransaction(void);

(In the source I linked, those last three are on lines 415-417.) Also that the typedef for SubXactCallback still looks like this?

typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid,
                                 SubTransactionId parentSubid, void *arg);

Thanks!

@antropoff
Copy link

Hi, @jcflack!

I have the same problem with 64-bit transaction id in Postgres Pro EE 13.
Answering your previous question (btw, header xact.h is on another path - .../include/server/access/):

  1. Yes, my xact.h has the same function prototypes, but on another lines (423 and 455-457).
  2. Yes, the typedef looks like yours.

Can you help me with using pl/java with 64-bit transaction ids?
Is there a workaround?

Thank you!

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

No branches or pull requests

3 participants