Skip to content

Failure to set thread priorities in some devices #213

@aperezdc

Description

@aperezdc

Reported to happen in a Huawei Mate 40:

WKWebView  D  loadUrl('https://igalia.com')
WPEAndroid D  WKWebView::nativeLoadUrl('...') [tid 10165]
libc       W  pthread_create sched_setscheduler(1073741825, {2}) call failed: Operation not permitted
WPEAndroid D  (process:10165): GLib-ERROR **: 12:15:59.370: 
              file ../glib/gthread-posix.c: line 1340 (g_system_thread_new): 
              error 'Operation not permitted' during 'pthread_create'

The cause seems to be that some vendors do not allow raising thread priorities, reported in mackron/miniaudio#993:

On some Android devices (mostly Huawei et Honor phones), the scheduling policy attribute of a thread cannot be set to SCHEDFIFO (real-time policy) using pthreadattrsetschedpolicy(3) because the main process doesn't have the CAPSYS_NICE which is required (capabilities(7)).

We should check at runtime somewhere during early startup whether raising thread priorities works, and then avoid doing setting priorities higher than the current if needed. Not sure what's the best place to do that... maybe inside WebKit itself?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions