Skip to content

do not miss original exception in std::iostreams#96455

Merged
CheSema merged 5 commits intomasterfrom
chesema-http-exceptions
Feb 11, 2026
Merged

do not miss original exception in std::iostreams#96455
CheSema merged 5 commits intomasterfrom
chesema-http-exceptions

Conversation

@CheSema
Copy link
Copy Markdown
Member

@CheSema CheSema commented Feb 9, 2026

We have tons of classes in POCO which use multiple inheritance like this

class Net_API HTTPChunkedOutputStream : public HTTPChunkedIOS, public std::ostream
class Net_API HTTPChunkedInputStream : public HTTPChunkedIOS, public std::istream

Here HTTPChunkedIOS and HTTPChunkedIOS do poco_ios_init(&_buf); in its c-tors. which is

#if defined(POCO_IOS_INIT_HACK)
#    define poco_ios_init(buf)
#else
#    define poco_ios_init(buf) do {                         \
    init(buf);                                              \
    this->exceptions(std::ios::failbit | std::ios::badbit); \
} while (0)
#endif

the main thing here is this->exceptions(std::ios::failbit | std::ios::badbit);

BUT the second parent std::ostream/std::istream does only this->init(__sb); and by this it rewrites __exceptions_ = goodbit;
So all the efforts with poco_ios_init was in vain. Thanks @Diskein, he quickly noticed that override.

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

set this->exceptions(std::ios::badbit); for the std's streams inside Poco.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@serxa serxa self-assigned this Feb 9, 2026
@clickhouse-gh
Copy link
Copy Markdown
Contributor

clickhouse-gh bot commented Feb 9, 2026

Workflow [PR], commit [4fd256a]

Summary:

job_name test_name status info comment
Finish Workflow failure
python3 ./ci/jobs/scripts/workflow_hooks/pr_body_check.py failure

@clickhouse-gh clickhouse-gh bot added the pr-improvement Pull request with some product improvements label Feb 9, 2026
@CheSema CheSema marked this pull request as ready for review February 9, 2026 17:22
@alexey-milovidov
Copy link
Copy Markdown
Member

This is golden! Thanks, @Diskein!

@CheSema CheSema added this pull request to the merge queue Feb 11, 2026
Merged via the queue into master with commit 77decda Feb 11, 2026
132 of 134 checks passed
@CheSema CheSema deleted the chesema-http-exceptions branch February 11, 2026 12:00
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 11, 2026
@serxa
Copy link
Copy Markdown
Member

serxa commented Mar 20, 2026

Are you okay if I backport this fix?

@robot-ch-test-poll robot-ch-test-poll added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Mar 23, 2026
robot-clickhouse-ci-2 added a commit that referenced this pull request Mar 23, 2026
Cherry pick #96455 to 25.12: do not miss original exception in std::iostreams
robot-clickhouse-ci-2 added a commit that referenced this pull request Mar 23, 2026
Cherry pick #96455 to 26.1: do not miss original exception in std::iostreams
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Mar 23, 2026
clickhouse-gh bot added a commit that referenced this pull request Mar 23, 2026
Backport #96455 to 26.1: do not miss original exception in std::iostreams
CheSema added a commit that referenced this pull request Mar 24, 2026
Backport #96455 to 25.12: do not miss original exception in std::iostreams
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-improvement Pull request with some product improvements pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v25.12-must-backport v26.1-must-backport v26.2-must-backport v26.3-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants