Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jf2gi-0004Xk-1B for pljava-dev@arkaria.postgresql.org; Sat, 30 May 2020 14:42:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jf2gg-00014K-Iy for pljava-dev@arkaria.postgresql.org; Sat, 30 May 2020 14:42:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jf2gg-000147-2y for pljava-dev@lists.postgresql.org; Sat, 30 May 2020 14:42:14 +0000 Received: from anastigmatix.net ([68.171.219.55]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jf2gY-0002IO-IU for pljava-dev@lists.postgresql.org; Sat, 30 May 2020 14:42:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Fg/RVer+0MaU6NVyq3NaU1Qt7jMgBqEHj7fdcyzaqEg=; b=vNMZ0s8rVNE7GADvgTAT9d9OE6 oQKsSMaCnTtQKE3u4KTzvjuJH99WMDUL2I2lEzottBzMI0VqBxJHbWBZSSHi6HolB/XfCZf5tGu3s zzUg4l1+rf1ruDoQbgkmEHDxHbzhJfznMJ8TyrDSIcalNm+UfEAoymrcYyM83dFlQCAR0e25Nkgvl n8cmqeQp84qk+rmb6rQYiu8rD2AxT3gm+rrbrkaRHX4RmlcGc5vjo67rDN++5ERRx5yTHqKMMxE2v 6jWOKtk4P9kriUSOn84Jd5msZ5wG8HksTxKlJVjixbAGT7U2IRIeiOrqGdJvvgywpjFJSp7+uU7I0 p6A29m2A==; Received: from [184.19.31.139] (port=52573) by bay.acenet.us with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1jf2gV-009mQX-Br; Sat, 30 May 2020 10:42:04 -0400 Subject: Re: Starting build-system work (Windows/Mac users please speak up) To: Kartik Ohri References: <5EC17E17.7070002@anastigmatix.net> <5ECED046.3000308@anastigmatix.net> <5ED0FCB0.405@anastigmatix.net> <5ED10C6D.2020000@anastigmatix.net> <5ED10F36.7060304@anastigmatix.net> <5ED15825.9060504@anastigmatix.net> Cc: pljava-dev@lists.postgresql.org From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5ED270BA.9010001@anastigmatix.net> Date: Sat, 30 May 2020 10:42:02 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-95.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 05/30/20 04:35, Kartik Ohri wrote: > "pljava.vmoptions" changed to > "-enableassertions:org.postgresql.pljava... -Xcheck:jni" > 11522020-05-30 08:04:54.113 UTC [10741] LOG: server process (PID > 12377) was terminated by signal 6: Aborted > 11532020-05-30 08:04:54.113 UTC [10741] DETAIL: Failed process was > running: CREATE EXTENSION pljava; Well, I'd say it looks like your work has caught its first PL/Java bug. :) I've been able to reproduce it here. Right during CREATE EXTENSION too, not even running the examples later. Good thing this is on 1.6.0-SNAPSHOT... So, I would say, retain all the work you've done on it so far, but make it possible to run without -Xcheck:jni for now, until I track down the bug(s). You might keep working on scripting to condense the -Xcheck:jni output. It should probably have found something like this: INFO: FATAL ERROR in native method: Bad global or local ref passed to JNI INFO: at org.postgresql.pljava.internal.ExecutionPlan._execute(org.postgresql.pljava.internal@1.6.0-SNAPSHOT/Native Method) ... INFO: at org.postgresql.pljava.internal.InstallHelper.groundwork(org.postgresql.pljava.internal@1.6.0-SNAPSHOT/InstallHelper.java:174) By the way, have you found any way to redirect just the -Xcheck:jni output somewhere, or only it in combination with other stderr from the backend? If it can only be redirected in combination with other stuff, I would be rather conservative about filtering it. I think I would just want to recognize and condense the WARNING: JNI local refs: %d, exceeds capacity: %d ( at ... | - locked <...> (a ...) )* pattern, which makes up the bulk of the output, and leave anything else untouched. We don't want to clobber other useful information in the logs, and even anything from -Xcheck:jni that isn't a local refs capacity warning should probably be left complete. If it's a FATAL ERROR it won't make the log file too big, 'cause there'll only be one. :) Diagnostic messages from Java code generally follow one of these paths: - they get explicitly sent to PostgreSQL's elog system, and go wherever the PostgreSQL logging is pointed, or suppressed depending on the enabled log level - Java exceptions caught and turned into PostgreSQL errors go into the PostgreSQL logs at level ERROR. - Separately, the stack traces of those exceptions are output if the PostgreSQL log level is set to DEBUG1 or finer. The code adjusts the vfprintf-hook log level (see below) to DEBUG1 before printing the stack trace, but I'm not positive it isn't just going to System.err and not through the hook. Should be easy enough to confirm, I just haven't had to before. - Messages from the JVM itself that are emitted through a 'vfprintf hook' are caught by PL/Java's hook [1] and injected into PostgreSQL's elog system at a selectable level, usually INFO. (That is probably the path being followed by the -Xcheck:jni messages, explaining why they have INFO: in front.) - Messages that are simply written to Java's System.err *can be* caught and included in PostgreSQL's logs, depending on PostgreSQL's logging_collector setting. [2] Otherwise, they just go wherever stderr was pointing when the PostgreSQL server was started (or wherever the server startup scripts point it). That could be, for example, the systemd journal. While filtering with the *idea* of grep seems like the right idea, I'm not sure the actual grep command will be an easy way to do that. The 'pattern' WARNING: JNI local refs: %d, exceeds capacity: %d ( at ... | - locked <...> (a ...) )* is obviously regular-expression pseudocode, but it's an expression that spans over multiple lines. If I were doing it, I would probably write a bit of Python (or jshell, if you prefer Java) and slurp in the whole log file; conveniently, both Python and Java have a MULTILINE regular expression option, so if you wanted you really could translate that pseudocode into a Python or Java regex and apply it over the whole file across line boundaries. (Java finally added a method to readAllBytes from a file [3], though it didn't happen until version 7!) Regards, -Chap [1] https://github.com/tada/pljava/blob/efbbc1d/pljava-so/src/main/c/Backend.c#L200 [2] https://www.postgresql.org/docs/9.5/runtime-config-logging.html#GUC-LOGGING-COLLECTOR [3] https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#readAllBytes(java.nio.file.Path)