Skip to content

include/container_ios: do not include <iomanip> - #72481

Open
MaxKellermann wants to merge 9 commits into
ceph:mainfrom
MaxKellermann:container_ios__include_cleanup
Open

MaxKellermann wants to merge 9 commits into
ceph:mainfrom
MaxKellermann:container_ios__include_cleanup

Conversation

@MaxKellermann

Copy link
Copy Markdown
Member

A copy of #72479 with a fix for a pre-existing header bug.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@github-actions github-actions Bot added the common label Oct 8, 2026
@tchaikov

tchaikov commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

@tchaikov tchaikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this changeset FTBFS:

[ 29%] Built target fusestore
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc: In member function 'void cephfs::mirror::PeerReplayer::add_live_sync_metrics_to_persist(json_spirit::mObject&, SnapSyncStat&)':
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:1038:32: error: 'setprecision' is not a member of 'std'
 1038 |       os << std::fixed << std::setprecision(2) << sync_pct << "%";
      |                                ^~~~~~~~~~~~
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:1052:32: error: 'setprecision' is not a member of 'std'
 1052 |       os << std::fixed << std::setprecision(2) << sync_file_pct << "%";
      |                                ^~~~~~~~~~~~
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc: In static member function 'static std::string cephfs::mirror::PeerReplayer::format_time(double)':
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:3723:21: error: 'setw' is not a member of 'std'; did you mean 'set'?
 3723 |             << std::setw(2) << std::setfill('0') << hours   << "h "
      |                     ^~~~
      |                     set
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:3723:37: error: 'setfill' is not a member of 'std'; did you mean 'fill'?
 3723 |             << std::setw(2) << std::setfill('0') << hours   << "h "
      |                                     ^~~~~~~
      |                                     fill
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:3724:21: error: 'setw' is not a member of 'std'; did you mean 'set'?
 3724 |             << std::setw(2) << std::setfill('0') << minutes << "m "
      |                     ^~~~
      |                     set
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:3724:37: error: 'setfill' is not a member of 'std'; did you mean 'fill'?
 3724 |             << std::setw(2) << std::setfill('0') << minutes << "m "
      |                                     ^~~~~~~
      |                                     fill
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:3725:21: error: 'setw' is not a member of 'std'; did you mean 'set'?
 3725 |             << std::setw(2) << std::setfill('0') << seconds << "s";
      |                     ^~~~
      |                     set
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:3725:37: error: 'setfill' is not a member of 'std'; did you mean 'fill'?
 3725 |             << std::setw(2) << std::setfill('0') << seconds << "s";
      |                                     ^~~~~~~
      |                                     fill
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:3728:21: error: 'setw' is not a member of 'std'; did you mean 'set'?
 3728 |             << std::setw(2) << std::setfill('0') << minutes << "m "
      |                     ^~~~
      |                     set
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:3728:37: error: 'setfill' is not a member of 'std'; did you mean 'fill'?
 3728 |             << std::setw(2) << std::setfill('0') << minutes << "m "
      |                                     ^~~~~~~
      |                                     fill
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:3729:21: error: 'setw' is not a member of 'std'; did you mean 'set'?
 3729 |             << std::setw(2) << std::setfill('0') << seconds << "s";
      |                     ^~~~
      |                     set
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:3729:37: error: 'setfill' is not a member of 'std'; did you mean 'fill'?
 3729 |             << std::setw(2) << std::setfill('0') << seconds << "s";
      |                                     ^~~~~~~
      |                                     fill
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:3732:21: error: 'setw' is not a member of 'std'; did you mean 'set'?
 3732 |             << std::setw(2) << std::setfill('0') << seconds << "s";
      |                     ^~~~
      |                     set
/ceph/debs/ubuntu/WORKDIR/ceph/src/tools/cephfs_mirror/PeerReplayer.cc:3732:37: error: 'setfill' is not a member of 'std'; did you mean 'fill'?
 3732 |             << std::setw(2) << std::setfill('0') << seconds << "s";
      |                                     ^~~~~~~

see https://jenkins.ceph.com/job/ceph-dev-pipeline/9650//consoleText

@MaxKellermann

Copy link
Copy Markdown
Member Author

this changeset FTBFS:

Oh, there's no shortage of header bugs in Ceph... I'll try to set up a clang/libc++ based build here to find them all.

@MaxKellermann

Copy link
Copy Markdown
Member Author

How is anybody ever able to build Ceph with clang?

In file included from /home/max/git/ceph-main/src/fmt/src/os.cc:13:
In file included from /home/max/git/ceph-main/src/fmt/include/fmt/os.h:11:
/home/max/git/ceph-main/src/fmt/include/fmt/format.h:747:28: error: use of undeclared identifier 'malloc'
  747 |     T* p = static_cast<T*>(malloc(n * sizeof(T)));
      |                            ^~~~~~
/home/max/git/ceph-main/src/fmt/include/fmt/format.h:752:35: error: use of undeclared identifier 'free'
  752 |   void deallocate(T* p, size_t) { free(p); }
      |                                   ^~~~

[...]

/home/max/git/ceph-main/src/rocksdb/env/fs_on_demand.cc:195:42: error: no member named 'back_inserter' in namespace 'std'
  195 |                    rchildren.end(), std::back_inserter(output));
      |                                          ^~~~~~~~~~~~~
/home/max/git/ceph-main/src/rocksdb/env/fs_on_demand.cc:233:40: error: no member named 'back_inserter' in namespace 'std'
  233 |                    result->end(), std::back_inserter(output), file_attr_sorter);
      |                                        ^~~~~~~~~~~~~

Build fails after two seconds or so.
A lot of work to do!

@idryomov

idryomov commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

How is anybody ever able to build Ceph with clang?

make check builds with clang on every push to every PR 🤷

@MaxKellermann

Copy link
Copy Markdown
Member Author

make check builds with clang on every push to every PR 🤷

That doesn't count because it uses GCC's libstdc++ instead of clang's libc++. The bugs are visible only with libc++ (which is the default on MacOS).

@MaxKellermann

Copy link
Copy Markdown
Member Author

I did my own LLVM/clang/libc++ build from git now, and with a bunch of weird kludges und bug fixes applied to Ceph/Boost/uadk/fmt, I can now build Ceph with that toolchain. (No joy here!)

However, @tchaikov's bug I could not reproduce. <iomanip> gets included implicitly this way (failure by intentionally chmod 0 iomanip to see the include chain easily:

FAILED: src/tools/cephfs_mirror/CMakeFiles/cephfs_mirror_internal.dir/PeerReplayer.cc.o 
In file included from /home/max/git/ceph-main/src/tools/cephfs_mirror/PeerReplayer.cc:18:
In file included from /home/max/git/ceph-main/src/common/ceph_context.h:37:
In file included from /home/max/git/ceph-main/src/msg/msg_types.h:26:
In file included from /home/max/git/ceph-main/src/fmt/include/fmt/ostream.h:12:
In file included from /usr/local/stow/llvm/bin/../include/c++/v1/fstream:198:
/usr/local/stow/llvm/bin/../include/c++/v1/__filesystem/path.h:33:12: fatal error: cannot open file '/usr/local/stow/llvm/bin/../include/c++/v1/iomanip': Permission denied
   33 | #  include <iomanip> // for quoted

Including fmt/ostream.h pulls in <fstream>, and <fstream> pulls in <iomanip>. All these indirect includes are very unfortunate, but they should prevent the bug from occurring.
Unless libc++ was built without localization support or without filesystem support. The filesystem API however is required by Ceph, and without localization, most of libc++ falls apart - not even stringstream is available (but I don't know what that has to do with localization - seems like a weird libc++ bug to me).
I tried to fail, but failed to fail.

What I will do now is fix just this one bug in PeerReplayer.cc and we play the next round of whack-a-mole.

@dvanders

dvanders commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@MaxKellermann I've kept #72479 open as the minimal fix (<ostream> only, <iomanip> kept; approved and green). Once it merges, this PR could rebase on it and carry the <iomanip> removal plus the frag.cc/PeerReplayer.cc include fixes. Does that work for you?

@MaxKellermann

Copy link
Copy Markdown
Member Author

Does that work for you?

Yes, I guess that's the best way forward, to get the regression fixed as quickly as possible.

Meanwhile, I'm trying to reduce more header dependencies to get rid of the indirect <iomanip> completely, expecting this will reveal more bugs.

@MaxKellermann
MaxKellermann force-pushed the container_ios__include_cleanup branch from d20a383 to 1a1e2e5 Compare October 9, 2026 06:16
@MaxKellermann
MaxKellermann requested a review from a team as a code owner October 9, 2026 06:16
@github-actions github-actions Bot added cephfs Ceph File System core mgr labels Oct 9, 2026
@MaxKellermann

Copy link
Copy Markdown
Member Author

With lots of patches from #60490 (plus more which I'll add to that draft PR) I was able to reproduce the problem. There were a few more problems, and I have added commits to fix them, but I cannot be sure if that's all.

@tchaikov please do another run.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@MaxKellermann
MaxKellermann force-pushed the container_ios__include_cleanup branch from 1a1e2e5 to 2d0cccc Compare October 9, 2026 20:11
@MaxKellermann

Copy link
Copy Markdown
Member Author

Once it merges, this PR could rebase on it and carry the <iomanip> removal plus the frag.cc/PeerReplayer.cc include fixes.

@dvanders, rebased.

@tchaikov

Copy link
Copy Markdown
Contributor

With lots of patches from #60490 (plus more which I'll add to that draft PR) I was able to reproduce the problem. There were a few more problems, and I have added commits to fix them, but I cannot be sure if that's all.

@tchaikov please do another run.

[2026-10-10T07:50:07Z DEBUG sccache::commands] Server sent CompileStarted
/ceph/debs/ubuntu/WORKDIR/ceph/src/test/osdc/object_cacher_misc.cc: In function 'int flush_test()':
/ceph/debs/ubuntu/WORKDIR/ceph/src/test/osdc/object_cacher_misc.cc:49:10: error: 'setw' was not declared in this scope; did you mean 'getw'?
   49 |       << setw(20) << "max_cache: " << max_cache << "\n"
      |          ^~~~
      |          getw
make[3]: *** [src/test/osdc/CMakeFiles/ceph_test_objectcacher_misc.dir/build.make:79: src/test/osdc/CMakeFiles/ceph_test_objectcacher_misc.dir/object_cacher_misc.cc.o] Error 1

see https://shaman.ceph.com/builds/ceph/wip-pr-72481-kefu-2/2d0cccc7ff2431ab8a00c1f47252262abd2c1731/default/498971/

@MaxKellermann

Copy link
Copy Markdown
Member Author

Thanks, @tchaikov. I wonder how this is possible, because this source includes <iomanip> indirectly via:

In file included from /home/max/git/ceph-main/src/test/osdc/object_cacher_misc.cc:22:
In file included from /home/max/git/ceph-main/src/osdc/ObjectCacher.h:20:
In file included from /home/max/git/ceph-main/src/osdc/Striper.h:22:
In file included from /home/max/git/ceph-main/src/osd/osd_types.h:36:
In file included from /home/max/git/ceph-main/src/fmt/include/fmt/ostream.h:12:
In file included from /usr/local/stow/llvm/bin/../include/c++/v1/fstream:198:
/usr/local/stow/llvm/bin/../include/c++/v1/__filesystem/path.h:33:12: fatal error: cannot open file '/usr/local/stow/llvm/bin/../include/c++/v1/iomanip': Permission denied

I'll try to eliminate more <fmt/ostream.h> includes from headers.

@MaxKellermann
MaxKellermann requested a review from a team as a code owner October 30, 2026 10:23
@MaxKellermann

Copy link
Copy Markdown
Member Author

Rebased & dropped patches that were already merged.

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@MaxKellermann
MaxKellermann force-pushed the container_ios__include_cleanup branch from eb3e403 to e360a1b Compare November 2, 2026 13:43
Comment thread src/mon/HealthMonitor.cc Resolved
Comment thread src/include/container_ios.h Resolved
@MaxKellermann MaxKellermann changed the title include/container_ios: do not include <iosfwd> include/container_ios: do not include <iomanip> Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

@MaxKellermann Thank you for reviewing this pull request! As a member of the Ceph organization, please add yourself to .githubmap in the main branch if you haven't already.

MaxKellermann and others added 9 commits November 3, 2026 07:51
Signed-off-by: Max Kellermann <[email protected]>
Signed-off-by: Max Kellermann <[email protected]>
Signed-off-by: Max Kellermann <[email protected]>
Signed-off-by: Max Kellermann <[email protected]>
Signed-off-by: Max Kellermann <[email protected]>
Signed-off-by: Max Kellermann <[email protected]>
Signed-off-by: Max Kellermann <[email protected]>
Nothing in this header uses a manipulator.

Reported-by: Bryan Stillwell <[email protected]>
Assisted-by: Claude-Code-v2.1.287:claude-opus-5-5
Signed-off-by: Dan van der Ster <[email protected]>
@MaxKellermann
MaxKellermann force-pushed the container_ios__include_cleanup branch from e360a1b to b2a2a91 Compare November 3, 2026 06:52

@tchaikov tchaikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@idryomov idryomov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ack from the RBD perspective

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath19-testing-20261109.054757-main.

@tchaikov

tchaikov commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

jenkins test make check

@anrao19

anrao19 commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to wip-anrao19-testing-2026-12-02-0609-main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants