r-causal icon indicating copy to clipboard operation
r-causal copied to clipboard

Even if Java's exceptions occurs, empty graph returns without any errors in search

Open yasu-sh opened this issue 1 year ago • 0 comments

This is the small note to record a known issue:

If you use large datasets or sets many required edges, you may get empty graph without any errors. This sympton is caused by the code as below:

https://github.com/bd2kccd/r-causal/blob/1649315ff44cdab78c80fccc573a39e0b1d27730/R/tetradrunner.R#L211

	# Search
	tetrad_graph <- .jcall(algo_instance, "Ledu/cmu/tetrad/graph/Graph;", 
		"search", tetradData, parameters_instance, check=FALSE)

	if(!is.null(e <- .jgetEx())){
		.jclear()
		tetradrunner$nodes <- colnames(df)
		tetradrunner$edges <- NULL
		# print("Java exception was raised")
		# print(e)

This suppress the error like this: Error in .jcall("RJavaArrayTools", "Z", "isArray", .jcast(o)) : java.lang.OutOfMemoryError: Java heap space

rJava documentation

.jgetEx polls for any pending exceptions and returns the exception object.

yasu-sh avatar Apr 05 '23 22:04 yasu-sh