dosubot[bot] commented on issue #7044: URL: https://github.com/apache/opendal/issues/7044#issuecomment-3663547589
<!-- Greeting --> Hi @carlsverre! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the opendal team. <!-- Answer --> This is a known and recurring bug in OpenDAL, especially with S3-compatible backends like Tigris and Minio, when using atomic write options such as `if_not_exists`. The warning from CompletionLayer ("writer has not been closed or aborted, must be a bug") is triggered when a write operation fails due to a precondition error (like HTTP 412 PreconditionFailed), and the writer is not properly closed or aborted. This issue has been reported in several contexts, including precondition failures, AlreadyExists, NotFound, and network/backend errors, and is linked to improper writer lifecycle management during error handling—often with concurrency or retries involved [[5101](https://github.com/apache/opendal/issues/5101), [4780](https://github.com/apache/opendal/issues/4780), [4012](https://github.com/apache/opendal/issues/4012)]. The maintainers recognize this as a bug and are actively investigating and working on fixes. As a workaround, some have suggested explicitly aborting the writer on error or checking file existence after a failed close, but the underlying issue is that writers should always be finalized (closed or aborted) in all error cases [[5101](https://github.com/apache/opendal/issues/5101)]. If you need to mitigate the warning in the meantime, you could try catching the error from `writer.close()` and explicitly aborting the writer, or verifying file existence after a precondition failure. For a long-term solution, the relevant code paths in CompletionLayer and writer error handling will need to be updated to ensure proper cleanup in all scenarios. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/024a953a-efc4-4f91-88bd-ec44053a809b?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/024a953a-efc4-4f91-88bd-ec44053a809b?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/024a953a-efc4-4f91-88bd-ec44053a809b?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/024a953a-efc4-4f91-88bd-ec44053a809b?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/024a953a-efc4-4f91-88bd-ec44053a809b?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/024a953a-efc4-4f91-88bd-ec44053a809b?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/024a953a-efc4-4f91-88bd-ec44053a809b?feedback_type=other)</sup> [](https://app.dosu.dev/997a2c5a-0c54-497b-989d-44651635dd36/ask?utm_source=github) [](https://cursor.com/link/prompt?text=This%20is%20a%20known%20and%20recurring%20bug%20in%20OpenDAL%2C%20especially%20with%20S3-compatible%20backends%20like%20Tigris%20and%20Minio%2C%20when%20using%20atomic%20write%20options%20such%20as%20%60if_not_exists%60.%20The%20warning%20from%20CompletionLayer%20%28%22writer%20has%20not%20been%20closed%20or%20aborted%2C%20must%20be%20a%20bug%22%29%20is%20triggered%20when%20a%20write%20operation%20fails%20due%20to%20a%20precondition%20error%20%28like%20HTTP%20412%20PreconditionFailed%29%2C%20and%20the%20writer%20is%20not%20properly%20closed%20or%20aborted.%20This%20issue%20has%20been%20reported%20in%20several%20contexts%2C%20including%20precondition%20failures%2C%20AlreadyExists%2C%20NotFound%2C%20and%20network/backend%20errors%2C%20and%20is%20link ed%20to%20improper%20writer%20lifecycle%20management%20during%20error%20handling%E2%80%94often%20with%20concurrency%20or%20retries%20involved%20%5B%5B5101%5D%28https%3A//github.com/apache/opendal/issues/5101%29%2C%20%5B4780%5D%28https%3A//github.com/apache/opendal/issues/4780%29%2C%20%5B4012%5D%28https%3A//github.com/apache/opendal/issues/4012%29%5D.%0A%0AThe%20maintainers%20recognize%20this%20as%20a%20bug%20and%20are%20actively%20investigating%20and%20working%20on%20fixes.%20As%20a%20workaround%2C%20some%20have%20suggested%20explicitly%20aborting%20the%20writer%20on%20error%20or%20checking%20file%20existence%20after%20a%20failed%20close%2C%20but%20the%20underlying%20issue%20is%20that%20writers%20should%20always%20be%20finalized%20%28closed%20or%20aborted%29%20in%20all%20error%20cases%20%5B%5B5101%5D%28https%3A//github.com/apache/opendal/issues/5101%29%5D.%0A%0AIf%20you%20need%20to%20mitigate%20the%20warning%20in%20the%20meantime%2C%20you%20could%20try%20catching%20the%20error%20fro m%20%60writer.close%28%29%60%20and%20explicitly%20aborting%20the%20writer%2C%20or%20verifying%20file%20existence%20after%20a%20precondition%20failure.%20For%20a%20long-term%20solution%2C%20the%20relevant%20code%20paths%20in%20CompletionLayer%20and%20writer%20error%20handling%20will%20need%20to%20be%20updated%20to%20ensure%20proper%20cleanup%20in%20all%20scenarios.) [](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/opendal/issues/7044) -- 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]
