liaoxin01 opened a new pull request, #64846: URL: https://github.com/apache/doris/pull/64846
## Proposed changes ### Problem When `RemoteFileSystem::upload()` is invoked from a bthread, `FILESYSTEM_M` dispatches `upload_impl` to an `AsyncIO` worker pthread that has **no attached task**. `upload_impl` reads the local file via `LocalFileReader::read_at_impl`, which runs `LIMIT_LOCAL_SCAN_IO` and unconditionally dereferences `thread_context()`. Without a `ThreadContext`, `thread_context()` throws `Status::FatalError` and the BE aborts (SIGABRT). This was observed as a Cloud P0 coredump. Crash stack: ``` Status::FatalError(...) status.h LocalFileReader::read_at_impl(...) local_file_reader.cpp (LIMIT_LOCAL_SCAN_IO -> thread_context()) FileReader::read_at(...) S3FileSystem::upload_impl(...) s3_file_system.cpp RemoteFileSystem::upload(...)::$_0 AsyncIO::run_task(...) WorkThreadPool<true>::work_thread(...) ``` The most likely trigger is the load error-log S3 upload path: `RuntimeState::get_error_log_file_path()` -> `_s3_error_fs->upload(error_log_absolute_path, _s3_error_log_file_path)` (cloud mode, `save_load_error_log_to_s3`). ### Fix Attach a task at the top of `upload_impl` using `ExecEnv::GetInstance()->s3_file_buffer_tracker()`, mirroring the existing fix in `batch_upload_impl` (added in #50017). This guarantees the local read always has a valid thread context, regardless of which thread `upload_impl` ends up running on. ### Notes `batch_upload_impl` already had this protection; the single-file `upload_impl` path was missed. Other single-file upload paths that go through `FILESYSTEM_M -> AsyncIO` and then call `LocalFileReader::read_at()` (HDFS/Broker/snapshot) are worth a follow-up audit. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
