I'm just wondering if it's possible to create a parallelStream inside a startup-event function. I discover quarkus at the moment and for testing i have to read a file and insert its files into the database on startup. Whenever is try to use a parallelStream
instead of a normal one, i get ACCESS_VIOLATION_EXCEPTION
.
Here's some Code so you can imagine what i'm doing. This example works.
void onStart(@Observes StartupEvent ev) throws Exception {
// Parsing the file, getting the iterator
it.readAll().stream().forEach(this::operateEntry);
}
@Transactional
void operateEntry(Entry entry) {
// Performing the database actions for a single entry
}
Using the same example but this time with an parallel stream results in an error:
void onStart(@Observes StartupEvent ev) throws Exception {
// Parsing the file, getting the iterator
it.readAll().parallelStream().forEach(this::operateEntry);
}
And the error message
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ffd5e59bf40, pid=15880, tid=20388
#
# JRE version: Java(TM) SE Runtime Environment (11.0.1+13) (build 11.0.1+13-LTS)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (11.0.1+13-LTS, mixed mode, tiered, compressed oops, g1 gc, windows-amd64)
# Problematic frame:
# V [jvm.dll+0x1ebf40]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# D:\knowledge\curator-service\target\hs_err_pid15880.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
I understand that parsing a bigger amount of data on every quarkus startup might not a realistic use-case. However i would like to understand why this does not work. I'm thankful for any advice.
Thank you in advance.
User contributions licensed under CC BY-SA 3.0