Hue PermissionError / multiprocessing Issue During Initial Startup

Hey folks,

I have been trying to get Hue running on RHEL9 against python 3.9. I am currently running into the following error when starting the server with build/env/bin/supervisor:

Environment:

Request Method: GET
Request URL: http://localhost:8888/hue/accounts/login

Django Version: 3.2.25
Python Version: 3.9.18
Installed Applications:
[‘django.contrib.auth’,
‘django.contrib.contenttypes’,
‘django.contrib.sessions’,
‘django.contrib.sites’,
‘django.contrib.staticfiles’,
‘django_extensions’,
‘django_babel’,
‘desktop’,
‘axes’,
‘webpack_loader’,
‘django_prometheus’,
‘crequest’,
‘rest_framework’,
‘rest_framework.authtoken’,
‘drf_spectacular’,
‘drf_spectacular_sidecar’,
‘indexer’,
‘metadata’,
‘notebook’,
‘dashboard’,
‘kafka’,
‘about’,
‘beeswax’,
‘filebrowser’,
‘help’,
‘hive’,
‘jobbrowser’,
‘jobsub’,
‘metastore’,
‘oozie’,
‘proxy’,
‘spark’,
‘useradmin’,
‘zookeeper’,
‘corsheaders’]
Installed Middleware:
[‘corsheaders.middleware.CorsMiddleware’,
‘desktop.middleware.MetricsMiddleware’,
‘desktop.middleware.EnsureSafeMethodMiddleware’,
‘desktop.middleware.AuditLoggingMiddleware’,
‘desktop.middleware.MultipleProxyMiddleware’,
‘django.middleware.common.CommonMiddleware’,
‘django.contrib.sessions.middleware.SessionMiddleware’,
‘django.contrib.auth.middleware.AuthenticationMiddleware’,
‘desktop.middleware.ProxyMiddleware’,
‘desktop.middleware.SpnegoMiddleware’,
‘desktop.middleware.HueRemoteUserMiddleware’,
‘django.middleware.locale.LocaleMiddleware’,
‘django_babel.middleware.LocaleMiddleware’,
‘desktop.middleware.AjaxMiddleware’,
‘django.middleware.security.SecurityMiddleware’,
‘django.middleware.clickjacking.XFrameOptionsMiddleware’,
‘desktop.middleware.ContentSecurityPolicyMiddleware’,
‘desktop.middleware.LoginAndPermissionMiddleware’,
‘django.contrib.messages.middleware.MessageMiddleware’,
‘desktop.middleware.NotificationMiddleware’,
‘desktop.middleware.ExceptionMiddleware’,
‘desktop.middleware.ClusterMiddleware’,
‘django.middleware.csrf.CsrfViewMiddleware’,
‘desktop.middleware.CacheControlMiddleware’,
‘django.middleware.http.ConditionalGetMiddleware’,
‘desktop.middleware.MimeTypeJSFileFixStreamingMiddleware’,
‘crequest.middleware.CrequestMiddleware’,
‘desktop.middleware.EnsureSafeRedirectURLMiddleware’,
‘useradmin.middleware.LastActivityMiddleware’,
‘axes.middleware.AxesMiddleware’]

Traceback (most recent call last):
File “/usr/lib64/python3.9/multiprocessing/managers.py”, line 802, in _callmethod
conn = self._tls.connection

During handling of the above exception (‘ForkAwareLocal’ object has no attribute ‘connection’), another exception occurred:
File “/usr/gmdp/current/hue/build/env/lib/python3.9/site-packages/django/core/handlers/exception.py”, line 47, in inner
response = get_response(request)
File “/usr/gmdp/current/hue/build/env/lib/python3.9/site-packages/django/utils/deprecation.py”, line 116, in call
response = self.process_request(request)
File “/usr/gmdp/current/hue/desktop/core/src/desktop/middleware.py”, line 888, in process_request
global_registry().update_metrics_shared_data()
File “/usr/gmdp/current/hue/desktop/core/src/desktop/lib/metrics/registry.py”, line 128, in update_metrics_shared_data
self._metrics_dict[os.getpid()] = metrics
File “”, line 2, in setitem

File “/usr/lib64/python3.9/multiprocessing/managers.py”, line 806, in _callmethod
self._connect()
File “/usr/lib64/python3.9/multiprocessing/managers.py”, line 793, in _connect
conn = self._Client(self._token.address, authkey=self._authkey)
File “/usr/lib64/python3.9/multiprocessing/connection.py”, line 506, in Client
c = SocketClient(address)
File “/usr/lib64/python3.9/multiprocessing/connection.py”, line 634, in SocketClient
s.connect(address)

Exception Type: PermissionError at /hue/accounts/login
Exception Value: [Errno 13] Permission denied

I’m using the /usr/gmdp/current/hue installation location because im trying to adapt an old mpack I found so the service can be managed by Ambari, i plan on installing under /usr/local/hue in the future. I’ve been stuck for a couple weeks with this one, so thought I’d post here. Any ideas?

I figured out the problem! So hue is creating pymp-* directories under tmp which contain a socket file. The directory and the socket file are getting created with 700 and 755 permissions respectively. I found that these permissions need to be 750 and 775 in order to get the server to startup successfully.

I will note I am running hue as root because when i try to run as a dedicated hue user I am similarly running into a permission error when hue is trying to run a os.setgid call, which non-root users shouldnt have permissions to do.

I’m looking into where I can tweak the permissions for these /tmp files, but if anyone notices any mistakes I’m making that would cause this problem please let me know. Thanks!