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

<expr>$map_batches() may crash the session #5

Open
eitsupi opened this issue Sep 27, 2024 · 3 comments
Open

<expr>$map_batches() may crash the session #5

eitsupi opened this issue Sep 27, 2024 · 3 comments

Comments

@eitsupi
Copy link
Owner

eitsupi commented Sep 27, 2024

It seems that if we run map_batches() consecutively as shown below, an error will eventually occur.

while(TRUE) {pl$select(pl$lit("a")$map_batches(\(...) 1)) |> print()}
Error: bad value
Error:
! Evaluation failed in `$select()`.
Caused by error:
! Evaluation failed in `$collect()`.
Caused by error in `PlRLazyFrame_filter()`:
! invalid formal argument list for "function"
Run `rlang::last_trace()` to see where the error occurred.

I think this indicates that something is wrong with inter-thread communication.
The same error occurs for the current r-polars, but it does not appear to occur when I set in_background=TRUE to have the UDF evaluated in a separate R session.

@eitsupi
Copy link
Owner Author

eitsupi commented Sep 28, 2024

Example to confirm that the cause of the segmentation fault is in map_batches()

x <- 0
while(TRUE) {pl$select(pl$lit("a")); print(x <<- x + 1)}
x <- 0
while(TRUE) {pl$select(pl$lit("a")$map_batches(\(...) 1)); print(x <<- x + 1)}

@etiennebacher
Copy link
Contributor

May be related: pola-rs/r-polars#1253

@eitsupi
Copy link
Owner Author

eitsupi commented Oct 12, 2024

May be related: pola-rs/r-polars#1253

The segmentation fault that occurs in this issue has nothing to do with the error, and according to my understanding has nothing to do with that issue.
See pola-rs/r-polars#1253 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants