amoeba opened a new issue, #37969:
URL: https://github.com/apache/arrow/issues/37969

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   Writing to a closed writer causes a segfault rather than an error. I ran 
into this while testing something unrelated, evaluating portions of a larger 
script in a REPL. Writing to a closed output errors as expected so the key here 
is `writer$Close()` and the subsequent `writer$WriteTable` call:
   
   ```r
   library(arrow)
   
   outfile <- tempfile(fileext = ".parquet")
   sink <- FileOutputStream$create(outfile)
   
   my_schema <- schema(letters = string())
   writer <- ParquetFileWriter$create(
     schema = my_schema,
     sink,
     properties = ParquetWriterProperties$create(
       column_names = names(my_schema),
       compression = arrow:::default_parquet_compression()
     )
   )
   tbl_arrow <- as_arrow_table(data.frame(letters=LETTERS), schema = my_schema)
   writer$WriteTable(tbl_arrow, chunk_size = 1)
   
   writer$Close()
   sink$close()
   
   tbl_arrow <- as_arrow_table(data.frame(letters=LETTERS), schema = my_schema)
   writer$WriteTable(tbl_arrow, chunk_size = 1)
   ```
   
   Result:
   
   ```
    *** caught segfault ***
   address 0x0, cause 'invalid permissions'
   
   Traceback:
    1: parquet___arrow___FileWriter__WriteTable(self, table, chunk_size)
    2: writer$WriteTable(tbl_arrow, chunk_size = 1)
   An irrecoverable exception occurred. R is aborting now ...
   fish: Job 1, 'Rscript arrow_memorypool_crashe…' terminated by signal SIGSEGV 
(Address boundary error)
   ```
   
   - OS/arch: macOS 14.0 (Sonoma), aarch64 (M2)
   - R: 4.3.1
   - arrow version: 13.0.0.1
   
   ### Component(s)
   
   R


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to