Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix physical memory detection on OSX #15405

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

vogievetsky
Copy link
Contributor

I just upgraded my Mac to MacOS Sonoma and I am unable to start Druid with bin/start-druid

image

This is due to the fact that the starter script can not detect the physical memory on my machine.
The physical memory is detected by doing sysctl -a | grep hw.memsize which for me now returns 2 values:

image

I am guessing that "hw.memsize_usable" was added in MacOS Sonoma as previously it worked.

The script then does a split(':') which for me produces ['hw.memsize', ' 68719476736\nhw.memsize_usable', ' 68719476736\n']

and the [1] index can not be parsed as a number.

I am fixing this by instead greping for sysctl -a | grep hw.memsize: the added : means that it should only match one line and is generally more robust.

I also rewrote the error message to be better, the original Please specify memory argument was accurate but confused me.

Copy link
Contributor

@abhishekagarwal87 abhishekagarwal87 left a comment

Choose a reason for hiding this comment

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

LGTM. I couldn't find any documentation on memsize_usable. do you know of any?

@@ -394,7 +394,7 @@ def convert_total_memory_string(memory):
physical_memory = get_physical_memory()

if physical_memory is None:
raise ValueError('Please specify memory argument')
raise ValueError('Could not automatically determine memory size. Please explitly specify the memory argument as --memory=<integer_value><m/g>')
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: spelling explicitly

@vogievetsky vogievetsky merged commit 1df53d6 into apache:master Nov 21, 2023
14 checks passed
@vogievetsky vogievetsky deleted the fix_physical_memory_detection branch November 21, 2023 07:19
@vogievetsky
Copy link
Contributor Author

No idea what memsize_usable is about. It is possible that it is very useful and we should prioritize using it over memsize (maybe it indicates the amount of "RAM" on M-series Macs with shared memory pools? I have an intel based mac so I can not confirm). In anycase memsize is what the script used before so I am not changing it, I am just making the grep detection more robust.

vogievetsky added a commit to vogievetsky/druid that referenced this pull request Nov 21, 2023
* fix physical memory detection on OSX

* typo
vogievetsky added a commit that referenced this pull request Nov 21, 2023
* fix physical memory detection on OSX

* typo
yashdeep97 pushed a commit to yashdeep97/druid that referenced this pull request Dec 1, 2023
* fix physical memory detection on OSX

* typo
@LakshSingla LakshSingla added this to the 28.0.1 milestone Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants