Weird Ref-count mismatch Message from H2O

H2O is a nice fast tools for data science work. I have discussed this topic in the following blogs:
H2O vs Sparkling Water
Sparking Water Shell: Cloud size under 12 Exception
Access Sparkling Water via R Studio
Running H2O Cluster in Background and at Specific Port Number
Recently we run into some weird issue when using H2O when using R Studio. For unknown reasons, it throws the following error messages:

score <-[,c('id', 'my_test_score')])

ERROR: Unexpected HTTP Status code: 500 Server Error (url =

 [1] "java.lang.IllegalStateException: Ref-count mismatch for vec $04ffc52a0000ffffffff$hdfs://ENKBDA1-ns/user/wzhou/test/data/test1/part-00000-8516f9f8-3d5f-164b-cf7e-18ca7e8d467f-d000.snappy.parquet: REFCNT = 2, should be 1"
 [2] "    water.rapids.Session.sanity_check_refs("                                                                                                                                                                                                     
 [3] "    water.rapids.Session.exec("                                                                                                                                                                                                                   
 [4] "    water.rapids.Rapids.exec("                                                                                                                                                                                                                     
 [5] "    water.api.RapidsHandler.exec("                                                                                                                                                                                                          
 [6] "    sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)"                                                                                                                                                                                                 
 [7] "    sun.reflect.DelegatingMethodAccessorImpl.invoke("                                                                                                                                                                        
 [8] "    java.lang.reflect.Method.invoke("                                                                                                                                                                                                             
 [9] "    water.api.Handler.handle("                                                                                                                                                                                                                    
[10] "    water.api.RequestServer.serve("                                                                                                                                                                                                        
[11] "    water.api.RequestServer.doGeneric("                                                                                                                                                                                                    
[12] "    water.api.RequestServer.doPost("                                                                                                                                                                                                       
[13] "    javax.servlet.http.HttpServlet.service("                                                                                                                                                                                                 
[14] "    javax.servlet.http.HttpServlet.service("                                                                                                                                                                                                 
[15] ""                                                                                                                                                                                
[16] ""                                                                                                                                                                            
[17] ""                                                                                                                                                                    
[18] ""                                                                                                                                                                             
[19] ""                                                                                                                                                                     
[20] ""                                                                                                                                                                         
[21] ""                                                                                                                                                                 
[22] ""                                                                                                                                                                       
[23] "    water.JettyHTTPD$LoginHandler.handle("                                                                                                                                                                                                    
[24] ""                                                                                                                                                                 
[25] ""                                                                                                                                                                       
[26] ""                                                                                                                                                                                               
[27] ""                                                                                                                                                        
[28] ""                                                                                                                                                         
[29] ""                                                                                                                                                              
[30] "$RequestHandler.content("                                                                                                                                              
[31] ""                                                                                                                                                                                      
[32] ""                                                                                                                                                                                 
[33] ""                                                                                                                                                                
[34] "$"                                                                                                                                                          
[35] ""                                                                                                                                                                      
[36] "$"                                                                                                                                                                       
[37] ""                                                                                                                                                                                                                        

Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page,  : 

Ref-count mismatch for vec $04ffc52a0000ffffffff$hdfs://ENKBDA1-ns/user/wzhou/test/data/test1/part-00000-8516f9f8-3d5f-164b-cf7e-18ca7e8d467f-d000.snappy.parquet: REFCNT = 2, should be 1

Tried different ways and still got the same error. Had to bounce the H2O cluster and get rid of this error. Then further investigation found out the steps we can reproduce this issue. If we delete some or all H2O frames from H2O UI, we could run into this issue.

Basically, just run getFrames command, then select the frames want to be deleted, click Delete selected frames at the bottom. Run getFrames again. It should show those frames deleted. But if I go to R Studio, run, it will show the exact Ref-count mismatch error. It seems like the frames were deleted from H2O UI perspective, but not from R Studio’s perspective.

Ok, we found out the cause. How to resolve it? Check out H2O source code at

we could see that this error is thrown during sanity_check_refs function. The function also has the following interesting description

Check that ref counts are in a consistent state.
* This should only be called between calls to Rapids expressions (otherwise may blow false-positives).

It seems there is something not handled well in other part of the code. If inconsistent in the object references, some other part of the code might fail. It looks bugs to me.

After some investigation, found out h2o.removeAll() running from R Studio should fix this issue.

2 thoughts on “Weird Ref-count mismatch Message from H2O

  1. Pingback: Use Python for H2O | My Big Data World

  2. Pingback: Parquet File Can not Be Read in Sparkling Water H2O | My Big Data World

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s