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

Webdriver stopped working after 1.0.0 upgrade. #12726

Closed
iercan opened this issue Jan 25, 2021 · 8 comments
Closed

Webdriver stopped working after 1.0.0 upgrade. #12726

iercan opened this issue Jan 25, 2021 · 8 comments
Labels
#bug Bug report

Comments

@iercan
Copy link
Contributor

iercan commented Jan 25, 2021

Hi.
I was using chrome driver. It was working fine with 0.38 but after 1.0.0 upgrade it stopped working.

Expected results

Thumbnails should work as expected.

Actual results

Throwing below error

worker_1    | [2021-01-25 08:06:54,859: INFO/ForkPoolWorker-10] Processing url for thumbnail: 2ff437e446e5ece836d6dfb06e1a50d0
worker_1    | Init selenium driver
worker_1    | [2021-01-25 08:06:54,860: INFO/ForkPoolWorker-10] Init selenium driver
worker_1    | Failed at generating thumbnail Instance <User at 0x7f0cfcfe63d0> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: http://sqlalche.me/e/13/bhk3)
worker_1    | [2021-01-25 08:06:56,662: ERROR/ForkPoolWorker-10] Failed at generating thumbnail Instance <User at 0x7f0cfcfe63d0> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: http://sqlalche.me/e/13/bhk3)

How to reproduce the bug

  1. Generate docker image with below Dockerfile
FROM apache/superset:1.0.0

USER root

RUN apt update
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && \
    apt install -y ./google-chrome-stable_current_amd64.deb && \
    wget https://chromedriver.storage.googleapis.com/88.0.4324.96/chromedriver_linux64.zip && \
    unzip chromedriver_linux64.zip && \
    chmod +x chromedriver && \
    mv chromedriver /usr/bin
USER superset
  1. Configure webdriver options. Note that I also tried other combinations of options. It stills fail.
WEBDRIVER_OPTION_ARGS = [
        "--force-device-scale-factor=2.0",
        "--high-dpi-support=2.0",
        "--headless",
        "--disable-gpu",
        "--disable-dev-shm-usage",
        "--no-sandbox",
        "--disable-extensions"
        ]

Environment

  • superset version: 1.0.0
  • python version: 3.7.9
  • chrome version: 88
@iercan iercan added the #bug Bug report label Jan 25, 2021
@iercan
Copy link
Contributor Author

iercan commented Jan 25, 2021

And this is detailed traceback

worker_1    | [2021-01-25 15:08:34,931: ERROR/ForkPoolWorker-1] Task cache_dashboard_thumbnail[996193c1-57ae-48af-a77a-af0672650a68] raised unexpected: DetachedInstanceError('Instance <User at 0x7fed472c7690> is not bound to a Session; attribute refresh operation cannot proceed')
worker_1    | Traceback (most recent call last):
worker_1    |   File "/usr/local/lib/python3.7/site-packages/celery/app/trace.py", line 412, in trace_task
worker_1    |     R = retval = fun(*args, **kwargs)
worker_1    |   File "/app/superset/app.py", line 116, in __call__
worker_1    |     return task_base.__call__(self, *args, **kwargs)
worker_1    |   File "/usr/local/lib/python3.7/site-packages/celery/app/trace.py", line 704, in __protected_call__
worker_1    |     return self.run(*args, **kwargs)
worker_1    |   File "/app/superset/tasks/thumbnails.py", line 77, in cache_dashboard_thumbnail
worker_1    |     user=user, cache=thumbnail_cache, force=force, thumb_size=thumb_size,
worker_1    |   File "/app/superset/utils/screenshots.py", line 152, in compute_and_cache
worker_1    |     payload = self.get_screenshot(user=user, window_size=window_size)
worker_1    |   File "/app/superset/utils/screenshots.py", line 74, in get_screenshot
worker_1    |     self.screenshot = driver.get_screenshot(self.url, self.element, user)
worker_1    |   File "/app/superset/utils/webdriver.py", line 104, in get_screenshot
worker_1    |     driver = self.auth(user)
worker_1    |   File "/app/superset/utils/webdriver.py", line 80, in auth
worker_1    |     driver, user
worker_1    |   File "/app/superset/utils/machine_auth.py", line 56, in authenticate_webdriver
worker_1    |     cookies = self.get_auth_cookies(user)
worker_1    |   File "/app/superset/utils/machine_auth.py", line 71, in get_auth_cookies
worker_1    |     login_user(user)
worker_1    |   File "/usr/local/lib/python3.7/site-packages/flask_login/utils.py", line 158, in login_user
worker_1    |     if not force and not user.is_active:
worker_1    |   File "/usr/local/lib/python3.7/site-packages/flask_appbuilder/security/sqla/models.py", line 150, in is_active
worker_1    |     return self.active
worker_1    |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/attributes.py", line 287, in __get__
worker_1    |     return self.impl.get(instance_state(instance), dict_)
worker_1    |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/attributes.py", line 718, in get
worker_1    |     value = state._load_expired(state, passive)
worker_1    |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/state.py", line 652, in _load_expired
worker_1    |     self.manager.deferred_scalar_loader(self, toload)
worker_1    |   File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/loading.py", line 944, in load_scalar_attributes
worker_1    |     "attribute refresh operation cannot proceed" % (state_str(state))
worker_1    | sqlalchemy.orm.exc.DetachedInstanceError: Instance <User at 0x7fed472c7690> is not bound to a Session; attribute refresh operation cannot proceed (Background on this error at: http://sqlalche.me/e/13/bhk3)

@dpgaspar
Copy link
Member

dpgaspar commented Jan 25, 2021

@iercan can you share your value for THUMBNAIL_SELENIUM_USER and the output from flask fab list-users (you can grep just the selenium user)?

@iercan
Copy link
Contributor Author

iercan commented Jan 25, 2021

Here is my settings.
THUMBNAIL_SELENIUM_USER = "ibrahim.ercan@vlmedia.com.tr"

# flask fab list-users |grep ibrahim.ercan
logging was configured successfully
INFO:superset.utils.logging_configurator:logging was configured successfully
username:ibrahim.ercan@vlmedia.com.tr | email:ibrahim.ercan@vlmedia.com.tr | role:[Admin]

We are using oauth. Maybe it is something about it?

@korpa
Copy link

korpa commented Jan 25, 2021

@cdmikechen and I have the same problem:
#10530 (comment)

@iercan
Copy link
Contributor Author

iercan commented Jan 26, 2021

Adding user = session.merge(user) solved problem for me too. I will send PR

@iercan
Copy link
Contributor Author

iercan commented Jan 26, 2021

After applied PR and doing further tests, I realized another problem. Dashboard thumbnails works but charts doesn't. I'm getting this error.

ERROR/ForkPoolWorker-2] Selenium timed out requesting url http://mydomain/superset/slice/898/?standalone=true

I tried to open this url with my browser and just saw nothing but white screen. Slice aren't loading. If I remove standalone=true It works fine. Looks like there is something wrong with standalone option.

@villebro
Copy link
Member

@

After applied PR and doing further tests, I realized another problem. Dashboard thumbnails works but charts doesn't. I'm getting this error.

ERROR/ForkPoolWorker-2] Selenium timed out requesting url http://mydomain/superset/slice/898/?standalone=true

I tried to open this url with my browser and just saw nothing but white screen. Slice aren't loading. If I remove standalone=true It works fine. Looks like there is something wrong with standalone option.

I believe this is resolved by #12606 and will be included in the forthcoming 1.0.1 release

@iercan
Copy link
Contributor Author

iercan commented Jan 26, 2021

@villebro I pulled latest image and it worked. Looking forward for 1.0.1 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#bug Bug report
Projects
None yet
Development

No branches or pull requests

4 participants