Getting a live view of environment variables (Gradle and JDK 9)

dalibor topic dalibor.topic at
Fri May 12 13:28:28 UTC 2017

On 11.05.2017 18:29, Cédric Champeau wrote:
>     Unfortunately, they are not safely mutable in multi-threaded
>     programs on many operating system/libc combinations.
> But the problem is less about mutating, that it is about reading: the VM
> returns wrong values at some point, because it _assumes_ that the
> environment variables are not mutated.

Right. Assuming that another thread could be simultaneously writing to 
the same data structure holding environment variables (char **), reading 
itself becomes problematic at such points in time, as you might read a 
temporarily corrupted data structure.

I guess the question underneath is if there is a safe point in time when 
reading the data could be preformed and no concurrent write from JNI 
code corrupting the data when it's partially read is possible.

dalibor topic
<> Dalibor Topic | Principal Product Manager
Phone: +494089091214 <tel:+494089091214> | Mobile: +491737185961

ORACLE Deutschland B.V. & Co. KG | Kühnehöfe 5 | 22761 Hamburg

ORACLE Deutschland B.V. & Co. KG
Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Jan Schultheiss, Val Maher

<> Oracle is committed to developing
practices and products that help protect the environment

More information about the core-libs-dev mailing list