xgboost icon indicating copy to clipboard operation
xgboost copied to clipboard

Random crash when training several models in same R session.

Open BlindApe opened this issue 11 years ago • 14 comments

I use xgboost from R with very big tables during several days and works fine, but I found that when I do several training in same session (like when I do bootstrapping in the training data and fit a model and do this 100 times sequentially) I get random crash. I tried to use gc() in each iteration, but doesn't work. I suspect the problem could be related with low level pointers / buffers that link R with C++ objects. Is there a way to clean all pointers / buffers used at low level by xgboost in R session? How to do a 'hard clean' or a 'reset' like you begin again from the scratch?

BlindApe avatar Sep 12 '15 11:09 BlindApe

I am not sure whether "hard clean" can solve the problem with no further information. Instead of the "hard clean", I suggest to write a single training Rscript and run it by Rscript training.R in a sequence.

Is the crash very rare or reproducible? We are also interested in fixing it.

hetong007 avatar Sep 14 '15 05:09 hetong007

I've tried to find a toy data set and reproduce the crash, but this is random (sometime at iteration 6 and other times at 36). I experimented it in two different servers (xeon cpu and ECC registered memory) running exclusively xgboost. I'm the unique user of these servers and use them only for machine learning, sometimes during several days or more than a week, without problem, so this is why I thought the problem could be a low level link degradation between R and xgboost core. I'll use the 'script call' work around and will write each result to disk and then read form other script that do the bagging merge. Thank you.

BlindApe avatar Sep 16 '15 12:09 BlindApe

What is the error you're getting? xgboost is crashing for me with a "This application has requested the Runtime to terminate in an unusual way" error at random times . I'm using xgb.cv in a loop for hyper-parameter tuning with 5 folds, nrounds = 5000. The crash occurs after some time - the 18th+ iteration of the loop. Any ideas? If this isn't the error you're getting, I'll open a separate thread.

bscheetz avatar Sep 21 '15 16:09 bscheetz

Yes. Sometimes with this message, sometimes just a 'not responding' in task manager with CPU and memory monitor blocked.

BlindApe avatar Sep 21 '15 16:09 BlindApe

Also, was it with xgb.cv or xgb.train?

bscheetz avatar Sep 21 '15 19:09 bscheetz

Both. After running several models in same R session, randomly crash.

BlindApe avatar Sep 26 '15 00:09 BlindApe

I'm going to try this in Python.

bscheetz avatar Sep 29 '15 12:09 bscheetz

@bscheetz Did you tried it in Python?

I continue with crashing nearly every big model I try with xgb.cv. 10 folds and 20000 trees never ends, but failed at different points. No error message, only frozen. In console the CPU monitor remainds with a constant use of one core and the memory used by the process constant.

Someone experimenting the same?

sessionInfo():

R version 3.2.2 (2015-08-14) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 8 x64 (build 9200)

locale: [1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252 LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C LC_TIME=Spanish_Spain.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] xgboost_0.4-2 data.table_1.9.6

loaded via a namespace (and not attached): [1] magrittr_1.5 Matrix_1.2-2 tools_3.2.2 stringi_0.5-5 grid_3.2.2 stringr_1.0.0 chron_2.3-47 lattice_0.20-33

BlindApe avatar Oct 11 '15 09:10 BlindApe

I still haven't gotten a chance to try it in python. Since models from R load in python, I don't have as much need to try it. If I get some time, I will work on it.

bscheetz avatar Oct 21 '15 23:10 bscheetz

closing for now due to inactive status, feel free to reopen

tqchen avatar Jan 15 '16 05:01 tqchen

Did you find any solution? I'm also experiencing the same issue. I'm fitting several models in a loop and my script always crashes on a random iteration.

vicmayrink avatar Jun 14 '16 19:06 vicmayrink

I am also having the same issue. I call xgb.train() within a while loop, and it will crash randomly after some time. Not sure what it is, anyone encountering the same problem?

ushanbrisk avatar Jun 23 '16 06:06 ushanbrisk

It would be much more useful if you could provide more context around those crashes. After what numbers of iterations does it usually happen? What is the size of your data? What is your system memory and what is the memory use when it crashes? The more info the better. You might also be creating objects in your script that accumulate during iterations. It might help to see some minimal code that still crashes for you.

khotilov avatar Jul 02 '16 22:07 khotilov

I am having the same issue. When I am going to train xgb.train, my r session aborted. I am not able to find the solution anywhere. Any suggestion will be appreciated.

vineetuser avatar Jun 20 '18 05:06 vineetuser