Re: Starting build-system work (Windows/Mac users please speak up)

From: Chapman Flack <chap(at)anastigmatix(dot)net>
To: Kartik Ohri <kartikohri13(at)gmail(dot)com>
Cc: pljava-dev(at)lists(dot)postgresql(dot)org
Subject: Re: Starting build-system work (Windows/Mac users please speak up)
Date: 2020-06-05 14:32:14
Message-ID: 5EDA576E.2000204@anastigmatix.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

On 06/05/20 09:44, Kartik Ohri wrote:
> pljava.debug | default | off
> pljava.enable | default | on
> pljava.implementors | default | postgresql
> pljava.java_thread_pg_entry | default | allow
> pljava.libjvm_location | session | C:/Program
> Files/Java/jdk14/bin/server/jvm.dll
> pljava.module_path | default | C:/Program
> Files/PostgreSQL/12/share/pljava/pljava-1.6.0-SNAPSHOT.jar;C:/Program
> Files/PostgreSQL/12/share/pljava/pljava-api-1.6.0-SNAPSHOT.jar
> pljava.release_lingering_savepoints | default | off
> pljava.statement_cache_size | default | 11
> pljava.vmoptions | default |
>
> ...
> 2020-06-05 13:27:20.385 UTC [3096] WARNING: Java virtual machine not yet
> loaded
> 2020-06-05 13:27:20.385 UTC [3096] DETAIL: Access is denied.
>
>
> 2020-06-05 13:27:20.385 UTC [3096] HINT: SET pljava.libjvm_location TO the

My attention is drawn most strongly to the "Access is denied." That isn't
a familiar error to me from non-Windows environments, so it might indicate
some Windows-specific access control policy that is preventing a file
being opened.

I would not read too much into what the HINT says; it is just a constant
string in the PL/Java source. It mentions libjvm_location because that's
a usual suspect, but it doesn't really know why the dlopen failed. The
DETAIL is the best information for that.

It might help some to say

\set VERBOSITY verbose

(a local command in psql, from the department of redundancy department),
and

set client_min_messages to debug2; -- it has to be spelled right :)

or even to experiment with pg_ls_dir(), pg_stat_file(),
pg_read_binary_file() [1] with the name of the JVM DLL or the directory
it lives in, to see if PostgreSQL always gets "Access is denied".
Presumably, if you spell the name wrong on purpose, you might get a
different error for that, and then you'll know this isn't a matter
of spelling the name right.

I found a StackOverflow thread [2] about some Windows settings that
might be relevant. Most of the answers there suggest changing settings
through the GUI (file/directory properties or service properties). I
didn't see anything about how to change from a script, though I assume
with PowerShell there is probably a way.

If this turns out to be a necessary step it will be good to get the
details into the PL/Java documentation for Windows, because I'm
pretty sure there's nothing about it in there now.

One more thing about setting client_min_messages; PL/Java only looks once,
just when starting the JVM, so for that setting to affect PL/Java, it has
to come before the first statement that causes PL/Java to load,

Regards,
-Chap

[1]
https://www.postgresql.org/docs/12/functions-admin.html#FUNCTIONS-ADMIN-GENFILE

[2]
https://stackoverflow.com/questions/4267051/error-5-access-denied-when-starting-windows-service

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Kartik Ohri 2020-06-06 12:40:26 Re: Starting build-system work (Windows/Mac users please speak up)
Previous Message Kartik Ohri 2020-06-05 13:44:25 Re: Starting build-system work (Windows/Mac users please speak up)