GitHub user stgztsw added a comment to the discussion: When Gunicorn workers 
are set to more than 1, some workers will fail to load sqlalchemy.dialects:doris

> This error is usually caused by environment or packaging issues: each 
> Gunicorn worker is a separate process and must have access to the Doris 
> dialect plugin via the pydoris package. If some workers can't load 
> `sqlalchemy.dialects:doris`, it's likely that pydoris isn't installed or 
> registered correctly in the Python environment used by all workers, or the 
> entry_point for the dialect is missing or broken. Superset relies on pydoris 
> to register the dialect via Python packaging metadata, not on its own code—so 
> this is typically an environment or packaging problem, not a Superset bug 
> ([source](https://github.com/apache/superset/issues/34072)).
> 
> To troubleshoot:
> 
> 1. In the same environment where Superset runs, check that the Doris dialect 
> is registered:
>    ```python
>    from importlib.metadata import entry_points
>    eps = entry_points()
>    dialects = eps.select(group='sqlalchemy.dialects') if hasattr(eps, 
> 'select') else eps.get('sqlalchemy.dialects', [])
>    print([f"{ep.name} = {ep.value}" for ep in dialects if 'doris' in ep.name])
>    ```
>    
>    
>        
>          
>        
>    
>          
>        
>    
>        
>      
>    You should see something like `doris = 
> pydoris.sqlalchemy.doris:DorisDialect`. If not, reinstall pydoris with `pip 
> install --force-reinstall pydoris` and make sure you're using the same Python 
> environment as Superset.
> 2. Make sure all Gunicorn workers use the same Python environment and have 
> access to the same installed packages. If you're using Docker, virtualenv, or 
> system Python, confirm that pydoris is installed in the environment where 
> Gunicorn launches Superset.
> 3. If the dialect is registered but you still see errors, check your Doris 
> SQLAlchemy URI. Superset expects a catalog in the URI; if it's missing, it 
> defaults to `internal`, which can cause connection issues. Try a URI like 
> `doris://user:pass@host:port/internal.schema` 
> ([source](https://github.com/apache/superset/issues/34072)).
> 4. After making changes, restart all Gunicorn workers to ensure they pick up 
> the correct environment and packages.
> 
> If you follow these steps, it should resolve the plugin loading error for all 
> workers. If the problem persists, there may be a deeper packaging or 
> environment issue.
> 
> _To reply, just mention [@dosu](https://go.dosu.dev/dosubot)._
> 
> How did I do? 
> [Good](https://app.dosu.dev/response-feedback/218bc72c-0a84-4e3d-9d76-1fc560221083?feedback_type=great_response)
>  | 
> [Irrelevant](https://app.dosu.dev/response-feedback/218bc72c-0a84-4e3d-9d76-1fc560221083?feedback_type=irrelevant_answer)
>  | 
> [Incorrect](https://app.dosu.dev/response-feedback/218bc72c-0a84-4e3d-9d76-1fc560221083?feedback_type=incorrect_sources)
>  | 
> [Verbose](https://app.dosu.dev/response-feedback/218bc72c-0a84-4e3d-9d76-1fc560221083?feedback_type=too_verbose)
>  | 
> [Hallucination](https://app.dosu.dev/response-feedback/218bc72c-0a84-4e3d-9d76-1fc560221083?feedback_type=hallucination)
>  | [Report 
> 🐛](https://app.dosu.dev/response-feedback/218bc72c-0a84-4e3d-9d76-1fc560221083?feedback_type=bug_report)
>  | 
> [Other](https://app.dosu.dev/response-feedback/218bc72c-0a84-4e3d-9d76-1fc560221083?feedback_type=other)
>   [![Chat with 
> Dosu](https://camo.githubusercontent.com/d9ffebb979729c9ef0fc4e3090dbae5b17cabbfec8afe378ada6b81913d6ad8a/68747470733a2f2f646f73752e6465762f646
 
f73752d636861742d62616467652e737667)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)
 [![Join 
Discord](https://camo.githubusercontent.com/d562c2df5e4567ea41d37f1d91a4da0839d8341037045b103b2da268998de17f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e2d3538363546323f6c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465266c6162656c3d)](https://go.dosu.dev/discord-bot)
 [![Share on 
X](https://camo.githubusercontent.com/4649f705e2396d6f328dbc8e800a0509c9c17b3b20253b36706c393df124b93d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f582d73686172652d626c61636b)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/35299)

Hi @dosu
Thanks for your replay, but your answer can't reslove my problem.
I tried the solution you proposed,and no problem in my enviroment. (When 
Gunicorn workers are set to 1, everything works normally. This also proves that 
the environment is problem-free)
I have an idea, but I'm not sure if it's correct. 
Pydoris is a lazily loaded package. When Superset starts, Pydoris has not yet 
been loaded. At this point, Gunicorn begins forking processes. Therefore, the 
forked processes do not have Pydoris loaded. However, the main process loads 
the Pydoris library afterward. This results in a situation where the main 
process functions normally, while the forked processes encounter exceptions.


GitHub link: 
https://github.com/apache/superset/discussions/35299#discussioncomment-14518519

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to