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

SAS Exporter - 2 Issues: Exhibits infinite growth; Crashes R; #234

Closed
mwh3780 opened this issue Oct 28, 2016 · 3 comments
Closed

SAS Exporter - 2 Issues: Exhibits infinite growth; Crashes R; #234

mwh3780 opened this issue Oct 28, 2016 · 3 comments

Comments

@mwh3780
Copy link

@mwh3780 mwh3780 commented Oct 28, 2016

There are several data sets that I work with that I am unable to export using haven. The R session either crashes or the export never finishes (and the size of exported file continues to grow into the GB/TB realm even when the data is relatively small).

Unable to export to SAS:
https://app.box.com/s/s2manpitopcyq2f0bj0fwi75ghqc0cgb
https://app.box.com/s/ev8rxwsg2j1413d7n48wu0xkeyjfnetf
https://app.box.com/s/nq552xwxde60n3q4hofob3am511h6i8d

Unable to export to SPSS:
https://app.box.com/s/qd2cggi588udrpkpdkk6v4axvtjl23ch

I am using:
haven_1.0.0
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

@hadley hadley added the reprex label Jan 25, 2017
@mwh3780 mwh3780 changed the title Exporting to SPSS & SAS: Crashes / Stuck SAS Exporter - 2 Issues: Exhibits infinite growth; Crashes R; Jan 27, 2017
@hadley
Copy link
Member

@hadley hadley commented Jan 30, 2017

Slightly cleaned up reprex below.

@evanmiller I still see both issues on latest haven.

library(haven)

zip_path <- tempfile()
download.file("https://www.dropbox.com/s/gxik3b08tmyh3bu/all_files.zip?dl=1", zip_path)
rdata_path <- unzip(zip_path, exdir = basename(zip_path))
(load(rdata_path))

# sas_df1 - Gets stuck in loop
haven::write_sas(sas_df1, tempfile())

# sas_df2 - Crashes R
haven::write_sas(sas_df2, tempfile())

# sas_df3 - Gets stuck in loop
haven::write_sas(sas_df3,  tempfile())

I've cleaned up the issue title/comment thread to focus on key components of problem. Thanks for the correspondence so far 😄

@evanmiller
Copy link
Collaborator

@evanmiller evanmiller commented Jan 30, 2017

sas_df2 is a divide-by-zero crash:

Exception Type:        EXC_ARITHMETIC (SIGFPE)
Exception Codes:       EXC_I386_DIV (divide by zero)
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Floating point exception: 8
Termination Reason:    Namespace SIGNAL, Code 0x8
Terminating Process:   exc handler [0]

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   haven.so                      	0x00000001100218ab sas7bdat_emit_header_and_meta_pages + 315
1   haven.so                      	0x00000001100215e4 sas7bdat_begin_data + 2292
2   haven.so                      	0x000000011001be55 readstat_begin_row + 165
3   haven.so                      	0x0000000110044645 Writer::write() + 1269
4   haven.so                      	0x0000000110044dd6 write_sas_(Rcpp::Vector<19, Rcpp::PreserveStorage>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >) + 70
5   haven.so                      	0x0000000110049c2f haven_write_sas_ + 175

All issues appear to be related to rows not fitting into the default (and, currently, only possible) page size of 4096 bytes. Per #270 it looks like rows longer than 2048 bytes cause a hang, and rows longer than 4096 bytes cause a crash.

@evanmiller
Copy link
Collaborator

@evanmiller evanmiller commented Jan 30, 2017

@hadley Should be "fixed" (return error instead of crash/hang) by WizardMac/ReadStat@7d9d580

@hadley hadley closed this in 330c873 Jan 31, 2017
@lock lock bot locked and limited conversation to collaborators Jun 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants