h2oai / h2o-3

H2O is an Open Source, Distributed, Fast & Scalable Machine Learning Platform: Deep Learning, Gradient Boosting (GBM) & XGBoost, Random Forest, Generalized Linear Modeling (GLM with Elastic Net), K-Means, PCA, Generalized Additive Models (GAM), RuleFit, Support Vector Machine (SVM), Stacked Ensembles, Automatic Machine Learning (AutoML), etc.
http://h2o.ai
Apache License 2.0
6.88k stars 1.99k forks source link

Starting H2O JVM and connecting: Error in file(con, "r") : cannot open the connection #16360

Closed lobin-xx closed 1 week ago

lobin-xx commented 1 month ago

hey!

Windows (with Admin rights), using R 4.4.1 I'm not able to run h2o using h2o.init. What is interesting once I'll try again it works. It is always not able to run every second time. This problem started from H2O Version 3.46.0.1 and is continuing until now. With versions Version 3.44.0.3 and older all is fine. Here is code and output from R: HERE IT STARTS

h2o.init( )

H2O is not running yet, starting it now...

Note: In case of errors look at the following log files: C:\Users\USER\AppData\Local\Temp\5\RtmpiSmDf8\file1bc86cac17e3/h2ostarted_from_r.out C:\Users\USER\AppData\Local\Temp\5\RtmpiSmDf8\file1bc85ab47ad4/h2ostarted_from_r.err

java version "17.0.7" 2023-04-18 LTS Java(TM) SE Runtime Environment (build 17.0.7+8-LTS-224) Java HotSpot(TM) 64-Bit Server VM (build 17.0.7+8-LTS-224, mixed mode, sharing)

Starting H2O JVM and connecting: Error in file(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") : cannot open file 'C:\Users\USER\AppData\Local\Temp\5\RtmpiSmDf8\file1bc86cac17e3/h2o_started_from_r.out': Permission denied

h2o.init() Connection successful!

R is connected to the H2O cluster: H2O cluster uptime: 14 seconds 977 milliseconds H2O cluster timezone: Europe/Warsaw H2O data parsing timezone: UTC H2O cluster version: 3.46.0.4 H2O cluster version age: 29 days H2O cluster name: H2O_started_from_R_USER_mac746 H2O cluster total nodes: 1 H2O cluster total memory: 29.97 GB H2O cluster total cores: 32 H2O cluster allowed cores: 32 H2O cluster healthy: TRUE H2O Connection ip: localhost H2O Connection port: 54321 H2O Connection proxy: NA H2O Internal Security: FALSE R Version: R version 4.4.1 (2024-06-14 ucrt)

h2.shutdown(Y) Error in h2.shutdown(Y) : could not find function "h2.shutdown" h2o.shutdown(Y) Error: object 'Y' not found h2o.shutdown() Are you sure you want to shutdown the H2O instance running at http://localhost:54321/ (Y/N)? Y

Here it ends. GO TO -> HERE IT STARTS

best! Lobi

tomasfryda commented 1 month ago

Thank you for reporting this issue.

The problem seems to be with a file we log to. It's annoying but it should not influence anything in any significant way and as you mentioned running h2o.init() twice is a workaround. Another workaround might be just running h2o backend separately and connecting to it using h2o.connect() from R.

wendycwong commented 1 month ago

According to @tomasfryda , this is a real problem. One possible problem is that windows don't allow accessing one file by multiple processes at the same time. He suspected that this commit could be the problem: https://github.com/h2oai/h2o-3/commit/cb35f0bc2a2732a7b2146636f737486beb4fbbd0 and suggested that the fix would be to add the informatino to the /Cloud response that we print when connected so we don't need to read a file that is in use and print the warning even when just connecting to the h2o.

wendycwong commented 1 month ago

The fool proof way to figure out which commit screwed up the window's users are to load h2o 3.44.0.3 and cherry-pick each commit until we hit the issue in case the guess was incorrect.