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

Huge battery consumption on iOS since 1.14.0 (SO_REUSEADDR) #328

Open
AmarOk1412 opened this issue May 31, 2021 · 4 comments
Open

Huge battery consumption on iOS since 1.14.0 (SO_REUSEADDR) #328

AmarOk1412 opened this issue May 31, 2021 · 4 comments

Comments

@AmarOk1412
Copy link

Hi.

Since pupnp 1.14.0, default configuration is causing a huge CPU consumption located in runMiniServer.
This is probably caused by a3912b0 cause SO_REUSEADDR is weirdly handled by iphone devices.

Adding the --disable-reuseaddr option solves this issue. IMHO, SO_REUSEADDR should not be enabled by default on Apple devices

@mrjimenez
Copy link
Collaborator

Hi Sébastien,

The default behavior is set in configure.ac or CMakeLists.txt, but this is not currently a platform based choice.

Do you think that this a regression introduced by this commit? Are you able to compile and test with the commit immediately before (cfbb791)?

Would it be possible to test this behavior in a PC? Do you have a small test code that I can use to try to fix it?

Regards,
Marcelo.

GerritRingMirror pushed a commit to savoirfairelinux/jami-daemon that referenced this issue May 31, 2021
This cause a huge battery drain. Issue reported upstream there:
pupnp/pupnp#328

Change-Id: I739aa6e3929297f2e09b4d37849106ca03c2635e
GitLab: #563
@AmarOk1412
Copy link
Author

AmarOk1412 commented May 31, 2021

Yeah setting the default value in the configure is correct.

We observed this behaviour only on iPhone devices via the profiler directly on the whole app. So, no I don't think you will get it on a PC (macOS doesn't seems to be impacted and I can't really provide a minimal code). I don't own any iphone so it's from a distant investigation with a dev. I can ping her to come here.

If you need more details:

  • Seems observable on pretty every iPhone devices. At least on the iPhone 5S, iphone 12 mini, iphone 10. But not on other platforms.
  • we use pupnp 1.14.0 with --disable-largefile --disable-samples --disable-device --disable-webserver --without-documentation
  • without --disable-reuseaddr, RunMiniServer is taking 94.5% of the time of the CPU, I didn't patch to debug more, but basically sure the while (!stopSock) { is just looping
  • with --disable-reuseaddr, RunMiniServer takes 0.5% of the time (on a run of 32 secs, which is ok)
  • We already observed weird behaviour with SO_REUSEADDR on apple devices, that's why we tried this.
  • cfbb791 is not affected (note that this commit was not building, had to apply https://github.com/pupnp/pupnp/commit/dccd9311d6db0a1be7e3348a11be94edaa850d77.diff), profiler gives 0.5% usage for RunMiniServer again

Thank you for your prompt answer,
Regards,

@katekm
Copy link

katekm commented Jun 18, 2021

Hi,
Issue is still present on iPhone and could be triggered by locking/unlocking the screen.
Tested with pupnp 1.14.7 with --disable-reuseaddr and without. Also tested with pupnp 1.12.1.
It caused by a while loop inside RunMiniServer. select() does not return an error but returns right away without blocking.

@tguillem
Copy link
Contributor

Hello, it should be fixed by #428 (I didn't know there was an issue)

GerritRingMirror pushed a commit to savoirfairelinux/jami-daemon that referenced this issue Jan 30, 2024
Upstream ticket: pupnp/pupnp#328
Upstream patch: pupnp/pupnp#428

GitLab: #563
Change-Id: Ie6f8c68a97a96759dd07df7a6a8be8a60968c4f1
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

No branches or pull requests

4 participants