Skip to content

Conversation

@ronaldklop
Copy link

Based on the Apple implementation rewritten to use _umtx_op syscall.

Based on the Apple implementation rewritten to use _umtx_op syscall.
@kelly-cs
Copy link
Contributor

kelly-cs commented Jan 9, 2025

Thanks for making this pull request! We just need a couple of things from you to start our consideration of the PR. Can you please:

  1. Sign our Contributor's Agreement.

  2. Create a new SERVER ticket on JIRA.

@ronaldklop
Copy link
Author

Thanks for making this pull request! We just need a couple of things from you to start our consideration of the PR. Can you please:

1. Sign our [Contributor's Agreement](https://www.mongodb.com/legal/contributor-agreement).

2. Create a new SERVER ticket on [JIRA](https://jira.mongodb.org/).

Thanks for your quick response.
I signed the agreement and created a ticket: https://jira.mongodb.org/browse/SERVER-99225.

@RedBeard0531
Copy link
Member

Sorry for the delay in writing back. My team owns this code and we have been debating internally what to do with this PR. On the one hand, we appreciate the effort to upstream support for other platforms. But on the other, we are hesitant to accept maintenance of code that isn't executed in our CI system and that we have limited ability to test. Our preference would probably be for you to maintain this as an out of tree patch. How much of a hardship would that be for you?

As for the code, I wanted to provide some feedback to ensure that you have the best version, regardless of whether it gets merged or maintained out-of-tree. Based on my reading of https://man.freebsd.org/cgi/man.cgi?query=_umtx_op&sektion=2&n=1, I think it would be better to base this off of the linux version rather than the apple version of the code. It seems like _umtx supports both absolute deadlines rather than relative timeouts, and supports a both nanosecond resolution and (assuming time_t is 64 bits) a long range into the future. The apple version needs to jump through some hoops to handle their unfortunate choice of 32-bit microseconds of relative timeouts.

@ronaldklop
Copy link
Author

Thanks for the answer. I understand the suggestion for the implementation with absolute time. I will take a look at that in the near future.

Maintaining the patches out of tree is doable. As I'm doing it for quite some time now. I just thought it would be nice to upstream some of this code. As it is a working port of MongoDB on a popular posix OS. Of course your team is in the lead and I'm happy with what you decide is possible.
Feel free to close the PR.

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this pull request Feb 13, 2025
Reimplement src/mongo/platform/waitable_atomic.cpp using absolute time.
This uses more simple conversions.
The implementation is now similar to the Linux version instead of the
MacOS version.

It should not have any functional change.

Reported by:	https://infosec.exchange/@david_chisnall/113797905538197081
Reported by:	mongodb/mongo#1607 (comment)
@RedBeard0531
Copy link
Member

I'm going to go ahead and close this. I'd rather we not merge non-trivial code that we don't have any ability to test in an ongoing manner in CI.

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this pull request Aug 28, 2025
Includes patch to implement waitable atomics for FreeBSD for
https://jira.mongodb.org/browse/SERVER-81797.
This patch is developed by me. It did not go through QA of MongoDB Inc.
I asked to upstream the patch but they don't want to take responsibilty
for code they don't run themselves. (Which I can understand from their
perspective.)
mongodb/mongo#1607 (comment)
https://jira.mongodb.org/browse/SERVER-99225
Anyway, this has run without errors for a while on my Raspberry Pi + net-mgmt/unifi9.
I don't have full QA in place and could only do limited testing. I can't
take any responsibilty for the quality of the patch.

Make backups and test for yourself in your setup before upgrading
any critical production environment.

Changes:
https://www.mongodb.com/docs/manual/release-notes/7.0/#7.0.23---aug-13--2025

Announcement:
https://www.mongodb.com/community/forums/t/mongodb-7-0-23-is-released/327242?u=r_k
freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this pull request Aug 30, 2025
Be pedantic that '!= 0' is not the same as '== -1'. And indeed -1 is what
is documented in the man page of _umtx_op to indicate an error.

No functional change expected.

Reported by:	mongodb/mongo#1607 (review)
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.

3 participants