Skip to content

Fix MacOS exception catching#9286

Merged
Mytherin merged 3 commits intoduckdb:mainfrom
carlopi:exceptionstypes
Oct 11, 2023
Merged

Fix MacOS exception catching#9286
Mytherin merged 3 commits intoduckdb:mainfrom
carlopi:exceptionstypes

Conversation

@carlopi
Copy link
Contributor

@carlopi carlopi commented Oct 10, 2023

To test this, add this as extension_config_local.cmake:

################# SPATIAL
duckdb_extension_load(spatial
        DONT_LINK LOAD_TESTS
        GIT_URL https://github.com/duckdblabs/duckdb_spatial.git
        GIT_TAG 36e5a126976ac3b66716893360ef7e6295707082
        INCLUDE_DIR spatial/include
        TEST_DIR test/sql
        )

on the main duckdb branch, then

GEN=ninja EXTENSION_STATIC_BUILD=1 make
./build/release/duckdb -unsigned -c "LOAD 'build/release/extension/spatial/spatial.duckdb_extension';CREATE TABLE zones AS SELECT zone, LocationId, borough, ST_GeomFromWKB(wkb_geometry) AS geom FROM ST_Read('taxi_zones.shx');"

Should error like: Error: Invalid Error: IO Error: GDAL Error (4): taxi_zones.shx: No such file or directory

while doing the same from this branch should give: Error: IO Error: GDAL Error (4): taxi_zones.shx: No such file or directory.

Fixes #6521

@carlopi
Copy link
Contributor Author

carlopi commented Oct 10, 2023

Note that this do not guarantees same behaviour in all cases between duckdb::Exception and std::exceptions with the right message, but should solve a big share of them while adding infrastructure to solve the remaining ones.

Final part could be either done incrementally in the more relevant places or via adding appropriate testing where we toggle between throwing unwrapped std::exceptions or duckdb::Exception, and expect results to be the same.

@github-actions github-actions bot marked this pull request as draft October 10, 2023 09:48
@carlopi carlopi marked this pull request as ready for review October 10, 2023 09:49
Copy link
Contributor

@Tishj Tishj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now 👍

@github-actions github-actions bot marked this pull request as draft October 10, 2023 12:54
@carlopi carlopi marked this pull request as ready for review October 10, 2023 12:54
@github-actions github-actions bot marked this pull request as draft October 10, 2023 15:24
@carlopi carlopi marked this pull request as ready for review October 10, 2023 15:31
@Mytherin Mytherin merged commit 9519890 into duckdb:main Oct 11, 2023
@Mytherin
Copy link
Collaborator

Thanks!

carlopi added a commit to carlopi/duckdb that referenced this pull request Oct 15, 2023
This commit might need to be backported (at least for MacOS builds) to previous released httpfs extension binaries
(most affected are v0.9.1 due to how this is put onto the spotlight due to duckdb#9286) to fix issue like duckdb#9340

My idea on how to proceed is as follow:
1. this can be merged into duckdb and have nightly binaries (and connected extensions) throwing
IOExceptions (that are properly handled) instead of specialized payload of HTTPExtensions
   This allows to test (on CI and on nightlies) whether this solves the actual problem
   This also allows, independently, to explore how to build specific extensions with a custom patch (this commit is basically
the patch)
2. Fixing the handling of HTTPExtension in core duckdb. Potentially this could  mean axing the HTTP-specific payload and moving
to a generic textual plus custom payload extracted via virtual funtion calls
carlopi added a commit to carlopi/duckdb that referenced this pull request Oct 15, 2023
This commit might need to be back-ported (at least for MacOS builds) to previous released httpfs extension binaries (most affected are v0.9.1 due to how this is put onto the spotlight due to duckdb#9286) to fix issue like duckdb#9340

My idea on how to proceed is as follow:
1. this can be merged into duckdb and have nightly binaries (and connected extensions) throwing IOExceptions (that are properly handled) instead of specialised payload of HTTPExtensions
   This allows to test (on CI and on nightlies) whether this solves the actual problem
   This also allows, independently, to explore how to build specific extensions with a custom patch (this commit is basically
the patch)
2. Fixing the handling of HTTPExtension in core duckdb. Potentially this could  mean axing the HTTP-specific payload and moving to a generic textual plus custom payload extracted via virtual function calls
carlopi added a commit to carlopi/duckdb that referenced this pull request Oct 15, 2023
This commit might need to be back-ported (at least for MacOS builds) to previous released httpfs extension binaries (most affected are v0.9.1 due to how this is put onto the spotlight due to duckdb#9286) to fix issue like duckdb#9340

My idea on how to proceed is as follow:

this can be merged into duckdb and have nightly binaries (and connected extensions) throwing IOExceptions (that are properly handled) instead of specialised payload of HTTPExtensions
This allows to test (on CI and on nightlies) whether this solves the actual problem
This also allows, independently, to explore how to build specific extensions with a custom patch (this commit is basically
the patch)
Fixing the handling of HTTPExtension in core duckdb. Potentially this could mean axing the HTTP-specific payload and moving to a generic textual plus custom payload extracted via virtual function calls
@carlopi carlopi deleted the exceptionstypes branch October 16, 2023 07:23
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.

Exceptions from MacOS extensions not caught properly

3 participants