-
Notifications
You must be signed in to change notification settings - Fork 5.8k
PhantomJS hangs on even simple examples #14186
Comments
Reproduced with the following Dockerfile: FROM alpine:3.3
MAINTAINER Ryan Schlesinger <ryan@outstand.com>
RUN apk add --no-cache \
build-base \
git \
perl \
openssl-dev \
flex \
bison \
gperf \
ruby \
fontconfig-dev \
freetype-dev \
sqlite-dev \
icu-dev \
libpng-dev \
libjpeg \
python \
libx11-dev \
libxext-dev \
linux-headers
ENV PHANTOMJS_VERSION 2.1.1
RUN git clone git://github.com/ariya/phantomjs.git && \
cd phantomjs && \
git checkout ${PHANTOMJS_VERSION} && \
git submodule init && \
git submodule update
WORKDIR /phantomjs
RUN cd src/qt/qtbase && wget -O - https://github.com/Vitallium/qtbase/pull/4.patch | patch -p1
RUN cd src/qt/qtwebkit && wget -O - https://github.com/Vitallium/qtwebkit/pull/9.patch | patch -p1
RUN python build.py --confirm --release --qt-config="-no-pkg-config" --git-clean-qtbase --git-clean-qtwebkit |
Repro'd on 6090f54 as well. (Comment out the first patch) |
Hitting the same problem. In my case the REPL doesn't even work. I'm trying to get a musl-libc build of phantomjs working, specifically for use in Alpine Linux without the I'm building from source (git tag The build process doesn't seem to run through any trouble, except for a few warnings on unused variables AFAICT (the build log is ginormous however, can't say I went through it all). However, when launching the binary, I get the REPL, but it doesn't seem to execute anything:
If anything is missing, I'd be happy to give more details. Additional info:
|
Looks like there are a number of efforts to get phantomjs working under Alpine, but it's not quite possible. See ariya/phantomjs#14186 as a good starting point
Might be the same as an issue I'm having. I'm using PhantomJS to run some jasmine specs. It locks up when encountering an undeclared variable and memory usage spikes to > 4GB. The problem has been reproduced on 2 machines using this repo: https://github.com/ptolemybarnes/jasmine-rails-issue Run Curiously if you move the unknown variable within the function passed to |
I'm encountering the same issue. Been fighting with this for a day now. Going to stop now that I know this is a bug others are encountering. |
May I suggest everyone who is hit by this give thumbs-up to the opening post? I think Alpine Linux is a natural OS to run (headless) automated tests on, and so it is worthwhile to quantify the level of support there is for fixing this issue. |
We instead ditched phantomjs because of this. |
We should probably rename this issue and specify that this is a musl/Alpine linux specific issue. |
I posted what I think might be the issue @ ncopa/docker-phantomjs-alpine#2 (comment) for @ncopa. Hopefully can get some progress going on this issue as this is my last real blocker from leveraging only alpine containers. |
+1 for getting this issue fixed. I just spend a few days getting a work around to work on my bamboo + docker w/ alpine. My stop gap work around fix was as follows: cls.browser.set_page_load_timeout(60)
cls.browser.implicitly_wait(0) when exiting the webdriver: import signal
cls.browser.service.process.send_signal(signal.SIGTERM)
cls.browser.kill('SIGTERM')
cls.browser.quit() and then I also use a retry decorator on all of my selenium/phantom JS tests that use the @retry()
def tearDown(self):
self.browser.get(self.get_reversed_url('logout')) Retry decorator as setup for my bamboo instance: import time
from functools import wraps
def retry(exceptions=Exception, attempts=3, delay=3, backoff=2, logger=None):
def deco_retry(f):
@wraps(f)
def f_retry(*args, **kwargs):
mtries, mdelay = attempts, delay
while mtries > 1:
try:
return f(*args, **kwargs)
except exceptions, e:
msg = "%s: %s, Retrying in %d seconds..." % (str(e.__class__.__name__), str(e), mdelay)
if logger:
logger.warning(msg)
else:
print msg
time.sleep(mdelay)
mtries -= 1
mdelay *= backoff
return f(*args, **kwargs)
return f_retry # true decorator
return deco_retry You can set this to pick up any exception or set it explicitly to the Also a little more complex way of doing this with trying to avoid the @Retry decorator is to override the unittest.TestCase.run method with a test wrapper; this did not work for us as we were doing .get() calls in teardown and those were not getting retried but if you don't do that this will retry your tests 3 times. http://stackoverflow.com/a/32248305 def run(self, result=None):
self.origTestMethodName = self._testMethodName
self._testMethodName = "_testRetryWrapper"
super(ATIPSeleniumTest, self).run(result)
self._testMethodName = self.origTestMethodName
def _testRetryWrapper(self):
testMethod = getattr(self, self.origTestMethodName)
retryAttemptsLeft = 3
while True:
try:
testMethod()
break
except:
if retryAttemptsLeft == 0:
raise
else:
print "Retrying in 3 seconds"
time.sleep(3)
retryAttemptsLeft = retryAttemptsLeft - 1 I hope this helps some people! |
I don't know how it took me so long to find this thread - I'm having the same issue. From the refs, it doesn't look like there's been much movement on this yet but has anyone had any luck implementing other workarounds? My choices at present seem to be limited to:
I would prefer more choices. |
@mattschofield even from other docker base image i can't make phantomjs work on my Alpine linux 3.6, i got a qt error
Did you succed ? |
@mattschofield That's the only option I've come up with, compiling it in an alpine based distro seems to have the same problem and I can't figure much out aside from it seems to have issues with a pselect call. |
@vitoo @thatsnotright in the end I went with a different base image. My feeling from all the conversations around this was that the Alpine base image just wasn't ready for phantomjs. I would require far greater knowledge of linux fundamentals to explain why this is the case. In case it's any use for anyone, we've had pretty good success switching to a |
Just if someone finds this helpfull - in docker with alpine 3.7 I just did this to make phantomjs work:
|
@aiomaster your solution is the best. |
Due to our very limited maintenance capacity (see #14541 for more details), we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed. In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution! |
I have built PhantomJS on Alpine Linux 3.3.3 . I have applied these two pull requests in order to get it to build:
vitallium/qtwebkit#9
vitallium/qtbase#4
examples/hello.js fails (as with all others tried.)
I see the same issues running 2.1.1 tag as well as current master (842715b as of this writing)
Here is an example: (note that I wait quite a while before hitting Control C)
Here is strace output:
phantomjs.strace.txt
Any ideas?
The text was updated successfully, but these errors were encountered: