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

segfaults/inconsistent results with is.na #1286

Closed
andrewblim opened this issue Jul 23, 2015 · 2 comments
Closed

segfaults/inconsistent results with is.na #1286

andrewblim opened this issue Jul 23, 2015 · 2 comments

Comments

@andrewblim
Copy link

Tried this on dplyr 0.4.2, R 3.2.1, and OS X 10.10.3. Coworker got similar results on Ubuntu 14.04.2 LTS.

Setup:

library(dplyr)
df <- data_frame(x=c(rep(c(0,NA),100000)))

df %>% dplyr::mutate(z = is.na(x)) works fine.

df %>% dplyr::mutate(y = 1, z = is.na(x)) sometimes seems to work fine but sometimes either hangs R or crashes it with an error that sometimes is the usual segfault "address 0x10b63a000, cause 'memory not mapped'" and sometimes an error on malloc:

R(88224,0x7fff72ccd300) malloc: *** error for object 0x10f9fab88: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

It doesn't always happen - running this up to 10 times sequentially is usually enough to get it to happen on my machine.

df %>% dplyr::mutate(y = 1, z = ifelse(is.na(x), 0, 1)) suffers the same problems as above and also sometimes returns inconsistent/incorrect results, for example:

   x     y z
1  0 FALSE 1
2  0 FALSE 1
3  0 FALSE 1
4  0 FALSE 1
5  0 FALSE 1
6  0 FALSE 1
7  0 FALSE 1
8  0 FALSE 1
9  0 FALSE 1
10 0 FALSE 1

or

    x y z
1   0 1 1
2  NA 0 0
3   0 1 1
4  NA 0 0
5   0 1 1
6  NA 0 0
7   0 1 1
8  NA 0 0
9   0 1 1
10 NA 0 0

Similar issues with SE calls df %>% dplyr::mutate_(1, ~ is.na(x)) and df %>% dplyr::mutate_(1, ~ ifelse(is.na(x), 0, 1)).

@romainfrancois
Copy link
Member

Did you try against the dev version ?

Envoyé de mon iPhone

Le 23 juil. 2015 à 17:53, Andrew Lim notifications@github.com a écrit :

Tried this on dplyr 0.4.2, R 3.2.1, and OS X 10.10.3. Coworker got similar results on Ubuntu 14.04.2 LTS.

Setup:

library(dplyr)
df <- data_frame(x=c(rep(c(0,NA),100000)))
df %>% dplyr::mutate(z = is.na(x)) works fine.

df %>% dplyr::mutate(y = 1, z = is.na(x)) sometimes seems to work fine but sometimes either hangs R or crashes it with an error that sometimes is the usual segfault "address 0x10b63a000, cause 'memory not mapped'" and sometimes an error on malloc:

R(88224,0x7fff72ccd300) malloc: *** error for object 0x10f9fab88: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
It doesn't always happen - running this up to 10 times sequentially is usually enough to get it to happen on my machine.

df %>% dplyr::mutate(y = 1, z = ifelse(is.na(x), 0, 1)) suffers the same problems as above and also sometimes returns inconsistent/incorrect results, for example:

x y z
1 0 FALSE 1
2 0 FALSE 1
3 0 FALSE 1
4 0 FALSE 1
5 0 FALSE 1
6 0 FALSE 1
7 0 FALSE 1
8 0 FALSE 1
9 0 FALSE 1
10 0 FALSE 1
or

x y z

1 0 1 1
2 NA 0 0
3 0 1 1
4 NA 0 0
5 0 1 1
6 NA 0 0
7 0 1 1
8 NA 0 0
9 0 1 1
10 NA 0 0
Similar issues with SE calls df %>% dplyr::mutate_(1, ~ is.na(x)) and df %>% dplyr::mutate_(1, ~ ifelse(is.na(x), 0, 1)).


Reply to this email directly or view it on GitHub.

@romainfrancois
Copy link
Member

I strongly believe this has been fixed in the dev version. Probably along fixing #1231
Please reopen when you still see the problem with the dev version.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 9, 2018
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

2 participants