Skip to contentSkip to conversation

ecj-initial.in: Disable multithreading to mitigate segfaulting

PATCH New Erkka Kääriä 1 participant 1 message Nov 10, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ecj-initial.in: Disable multithreading to mitigate segfaulting

Cacao-initial-native suffers from sporadic segmentation faults, when the Java program uses multiple Java threads, due to a race condition. In particular, jamvm-native and classpath-native builds would occasionally fail as the eclipse compiler used during build task by default uses multiple threads.

As fixing the race condition would require large changes to the cacao-initial-native codebase, and as it is only used briefly during the bootstrapping process, it is easier and safer to just force ecj-initial to run in a singlethreaded mode.

---
 recipes-core/ecj/files/ecj-initial.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
recipes-core/ecj/files/ecj-initial.in +3 -1
index 2099991..30c1c8a 100755
@@ -1 +1,3 @@
-${RUNTIME} -Xmx512m -cp ${ECJ_JAR} org.eclipse.jdt.internal.compiler.batch.Main ${1+"$@"}
+# -Djdt.compiler.useSingleThread=true forces the compiler to only use a single thread. This is a workaround to a race condition
+# bug in cacao-initial-native, where using multiple java thread could cause sporadic segmentation faults
+${RUNTIME} -Xmx512m -Djdt.compiler.useSingleThread=true -cp ${ECJ_JAR} org.eclipse.jdt.internal.compiler.batch.Main ${1+"$@"}
Signature · 12 lines
2.1.4

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.