mapleFU opened a new issue, #39715:
URL: https://github.com/apache/arrow/issues/39715
### Describe the enhancement requested
Parquet uses `FileSerializer` to write File. And the `FileSerializer` has
`page_index_builder_` and `file_encryptor`. In the happy path, the dtor
ordering is ok:
```c++
void Close() override {
if (is_open_) {
// If any functions here raise an exception, we set is_open_ to be
false
// so that this does not get called again (possibly causing segfault)
is_open_ = false;
if (row_group_writer_) {
num_rows_ += row_group_writer_->num_rows();
row_group_writer_->Close();
}
row_group_writer_.reset();
WritePageIndex();
// Write magic bytes and metadata
auto file_encryption_properties =
properties_->file_encryption_properties();
if (file_encryption_properties == nullptr) { // Non encrypted file.
file_metadata_ = metadata_->Finish(key_value_metadata_);
WriteFileMetaData(*file_metadata_, sink_.get());
} else { // Encrypted file
CloseEncryptedFile(file_encryption_properties);
}
}
```
However, if `Close` throw exception, the `row_group_writer_` may dtor after
`file_encryption` and `page_index_builder`. Causing the memory issue.
### Component(s)
C++, Parquet
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]