Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gc() corruption-related crashes introduced in 3.2.4 affecting DBI occurs on memory overload #135

Closed
ajdamico opened this issue Mar 16, 2016 · 12 comments
Milestone

Comments

@ajdamico
Copy link

hi, r core has disclaimed responsibility for this bug. this bug is hugely disruptive for DBI users and it's likely a gc() bug not a DBI or RSQLite bug but i do not have the technical know-how to distill this down any further than i already have. the examples provided to the r-core team are minimal and easily reproducible, but (as they correctly mention) rely on this contributed package.

https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16734

could someone on the RSQLite team please help me reconfigure my minimal reproducible example so that we can re-open this r-project ticket? here's how simple it is

# initiate R with "C:\Program Files\R\R-3.2.4\bin\x64\Rterm.exe" --max-mem-size=35M
library(RSQLite)
db <- dbConnect( SQLite() )
for( i in 1:1000 ) { dbWriteTable( db , 'x' , mtcars , append = TRUE ) }
# CRASH

thank you!

cc @hannesmuehleisen @hadley @krlmlr

@hadley
Copy link
Member

hadley commented Mar 16, 2016

Have you tried using the dev version? I can't reproduce locally with:

library(DBI)
db <- dbConnect(RSQLite::SQLite())
for(i in 1:1e6) { 
  dbWriteTable(db , 'x', mtcars, append = TRUE) 
}

I also don't see any problems when running under valgrind.

@ajdamico
Copy link
Author

hi, i think the problem happens when RAM starts paging, so doubt you can reproduce on any OS until you max out your hardware -- 1e6 may not be enough? installing the dev version of RSQLite is failing for me. it's possible this bug is windows-only, but both hannes and i have reproduced on different windows computers.. note that it occurs on MonetDBLite also which is why i originally filed under DBI thanks

@hadley
Copy link
Member

hadley commented Mar 16, 2016

Well 1000 x 35 mb = 35 gb, which is more memory than I have. So I suspect it's a windows only bug.

@ajdamico
Copy link
Author

sorry if i'm being dense, object.size(mtcars) * 10^6 is only 6.7gb? i agree it might be windows-only.. thanks for your time, hadley

@ajdamico
Copy link
Author

ajdamico commented Jul 9, 2016

hi @krlmlr any chance you could explore this in the next month or two? thanks for all your work

@krlmlr krlmlr added this to the 1.1 milestone Aug 17, 2016
@krlmlr
Copy link
Member

krlmlr commented Sep 7, 2016

Can reproduce it on my Windows machine with R3.3.0-patched.

I only get crashes for specific values of --max-mem-size:

  • 30, 31: works
  • 32-35: crashes at 330 < i <= 340
  • 36-37: crashes at 340 < i <= 350
  • 38, 50: works

@krlmlr
Copy link
Member

krlmlr commented Sep 7, 2016

Can also reproduce on Linux with the following script, crashing with 670 < i <= 680:

ulimit::memory_limit(318)
library(RSQLite)
db <- dbConnect( SQLite() )
for( i in 1:1000 ) { if (i %% 10 == 0) print(i); dbWriteTable( db , 'x' , mtcars , append = TRUE ) }
# CRASH

Unfortunately, ulimit doesn't work on OS X.

@krlmlr
Copy link
Member

krlmlr commented Sep 7, 2016

I'm fairly certain that this is an R problem. Working on isolating a trigger to reopen the R ticket.

@ajdamico
Copy link
Author

ajdamico commented Sep 7, 2016

crazy. thanks! anything to resubmit the bug to rcore would be helpful..
what's going on internally is far beyond me. but this error happens in
MonetDBLite as well so probably a base R problem. thank you for your time
:)

On Sep 7, 2016 11:38 PM, "Kirill Müller" notifications@github.com wrote:

Can also reproduce on Linux with the following script, crashing with 670 <
i <= 680:

ulimit::memory_limit(318)
library(RSQLite)db <- dbConnect( SQLite() )for( i in 1:1000 ) { if (i %% 10 == 0) print(i); dbWriteTable( db , 'x' , mtcars , append = TRUE ) }# CRASH

Unfortunately, ulimit doesn't work on OS X.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#135 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AANO5_k5gOKH970RtXrNLNVAARdDgwwwks5qnsx9gaJpZM4HyXPl
.

@krlmlr
Copy link
Member

krlmlr commented Sep 7, 2016

The problem seems to occur only if the memory limit is set to something barely above the minimum requirements to run the code. I've seen at least four different error messages and tracebacks.

The worst, however, seems to be an infinite recursion, which I've reported at https://bugs.r-project.org/bugzilla/show_bug.cgi?id=17144.

@krlmlr krlmlr closed this as completed Sep 7, 2016
@ajdamico
Copy link
Author

ajdamico commented Sep 8, 2016

hey, thanks a million

troels pushed a commit to troels/RSQLite that referenced this issue Nov 27, 2019
- Improved documentation of the `dbname` argument to `dbConnect()`, it now specifically mentions that connection strings cannot be used (r-dbi#135).
troels pushed a commit to troels/RSQLite that referenced this issue Nov 27, 2019
- Improved documentation of the `dbname` argument to `dbConnect()`, it now specifically mentions that connection strings cannot be used (r-dbi#135).
- `dbConnect()` gains a `bigint` argument that optionally coerces 64-bit integer values to `integer`, `numeric` or `character`. By default, the `bit64::integer64` data type is used (r-dbi#141).
- Use `blob_cast` tweak to pass blob tests.
- Adapt data fetching logic from RSQLite, for multi-row binding (r-dbi#100).
@github-actions
Copy link

github-actions bot commented Dec 9, 2020

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants