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

Avoid check on MZ_OPEN_MODE_READWRITE (being composed of READ | WRITE) #6

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

carlopi
Copy link
Collaborator

@carlopi carlopi commented Jan 5, 2025

I checked implementation MZ_OPEN_MODE_READWRITE is a combination of READ bit and WRITE bit ([example](https://pub.dev/documentation/flutter_minizip_ffi_bindings/latest/flutter_minizip_ffi_bindings/MZ_OPEN_MODE_READWRITE-constant.html, 1 | 2 = 3)

That means that MZ_OPEN_MODE_READWRITE & flags will be true if EITHER read or write are set, this in turns make file opened for reading with a flags connected to writing.

This I think trigger failures like:

================================================================================
Query unexpectedly failed (D:/a/duckdb/duckdb/build/release/_deps/excel_extension_fc-src/test/sql/excel/xlsx/read_sparse.test:31)
================================================================================
select * FROM read_xlsx('test/data/xlsx/sparse.xlsx', header = false, range = 'W801:W801');
================================================================================
Actual result:
IO Error: Cannot open file "test/data/xlsx/sparse.xlsx": The process cannot access the file because it is being used by another process.

and problem while using in duckdb-wasm (that due to weird file system requires either write or read permissions).

I checked implementation MZ_OPEN_MODE_READWRITE is a combination of READ bit and WRITE bit.

That means that MZ_OPEN_MODE_READWRITE & flags will be true if EITHER read or write are set, this in turns make file opened for reading with a flags connected to writing.

This I think trigger failures like:
```
================================================================================
Query unexpectedly failed (D:/a/duckdb/duckdb/build/release/_deps/excel_extension_fc-src/test/sql/excel/xlsx/read_sparse.test:31)
================================================================================
select * FROM read_xlsx('test/data/xlsx/sparse.xlsx', header = false, range = 'W801:W801');
================================================================================
Actual result:
IO Error: Cannot open file "test/data/xlsx/sparse.xlsx": The process cannot access the file because it is being used by another process.
```
and problem while using in duckdb-wasm (that due to weird file system requires either write or read permissions).
@carlopi carlopi requested a review from Maxxen January 5, 2025 15:04
@carlopi
Copy link
Collaborator Author

carlopi commented Jan 5, 2025

Not ready, given this fails Windows CI, but the way I read the errors is that basically when first writing then reading a file, like in https://github.com/duckdb/duckdb-excel/blob/main/test/sql/excel/xlsx/bignum.test, there is something off with lifetimes of the FileHandles in Windows. I think FileHandle somehow survive the query duration / are cached, but unsure.

Help might be handy in bringing this in.

@Maxxen Maxxen merged commit 346c3d8 into duckdb:main Jan 6, 2025
22 checks passed
@carlopi carlopi deleted the avoid-mz_open_mode_readwrite branch January 6, 2025 14:41
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

Successfully merging this pull request may close these issues.

2 participants