Bert-as-service: zmq.error.ZMQError: Operation not permitted

Created on 27 Mar 2019  ·  10Comments  ·  Source: hanxiao/bert-as-service

Prerequisites

Please fill in by replacing [ ] with [x].

System information

Some of this information can be collected via this script.

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04):
  • TensorFlow installed from (source or binary): Dockerfille
  • TensorFlow version: 1.12.0
  • Python version: 3.5
  • bert-as-service version: 1.8.6
  • GPU model and memory:
  • CPU model and memory:

Description

Please replace YOUR_SERVER_ARGS and YOUR_CLIENT_ARGS accordingly. You can also write your own description for reproducing the issue.

I'm using this command to start the server:

bert-serving-start -num_worker=1 -model_dir /app/model/chinese_L-12_H-768_A-12

Then this issue shows up:

I:VENTILATOR:[__i:__i: 66]:freeze, optimize and export graph, could take a while...
I:GRAPHOPT:[gra:opt: 52]:model config: /app/model/chinese_L-12_H-768_A-12/bert_config.json
I:GRAPHOPT:[gra:opt: 55]:checkpoint: /app/model/chinese_L-12_H-768_A-12/bert_model.ckpt
I:GRAPHOPT:[gra:opt: 59]:build graph...
I:GRAPHOPT:[gra:opt:128]:load parameters from checkpoint...
I:GRAPHOPT:[gra:opt:132]:optimize...
I:GRAPHOPT:[gra:opt:140]:freeze...
I:GRAPHOPT:[gra:opt:145]:write graph to a tmp file: /tmp/tmptpgyzj7m
I:VENTILATOR:[__i:__i: 74]:optimized graph is stored at: /tmp/tmptpgyzj7m
I:VENTILATOR:[__i:_ru:118]:bind all sockets
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.5/dist-packages/bert_serving/server/__init__.py", line 104, in run
    self._run()
  File "/usr/local/lib/python3.5/dist-packages/zmq/decorators.py", line 75, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/zmq/decorators.py", line 75, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/zmq/decorators.py", line 75, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/bert_serving/server/zmq_decor.py", line 27, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/bert_serving/server/__init__.py", line 120, in _run
    addr_front2sink = auto_bind(sink)
  File "/usr/local/lib/python3.5/dist-packages/bert_serving/server/helper.py", line 192, in auto_bind
    socket.bind('ipc://{}'.format(tmp_dir))
  File "zmq/backend/cython/socket.pyx", line 547, in zmq.backend.cython.socket.Socket.bind
  File "zmq/backend/cython/checkrc.pxd", line 25, in zmq.backend.cython.checkrc._check_rc
zmq.error.ZMQError: Operation not permitted

dockerfile:

FROM tensorflow/tensorflow:1.12.0-py3
RUN pip install bert-serving-server

COPY ./ /app
COPY ./entrypoint.sh /app
WORKDIR /app

run:

docker run -it --rm -p 5555:5555 -p 5556:5556 -v /e/project/docker/python/bert:/app -t bert-as-service sh

...

Most helpful comment

no, the problem is consistently reproduced.
need create dir and export to env
export ZEROMQ_SOCK_TMP_DIR=/tmp/zmq
link: https://sanidem.home.blog/tag/docker/

All 10 comments

I met the same problem!
I installed tensorflow-gpu 1.11.0 in anaconda.
After I type the command "bert-serving-start -model ./chinese_L-12_H-768_A-12 -num_worker=2", there comes an error:
File "zmq/backend/cython/socket.pyx", line 547, in zmq.backend.cython.socket.Socket.bind
File "zmq/backend/cython/checkrc.pxd", line 25, in zmq.backend.cython.checkrc._check_rc
zmq.error.ZMQError: Operation not permitted

I have solved this problem. It may be due to the bad or unstable Internet. I didn't do anything and the problem fixed by itself.

@zyj008 不可能吧,你确定没改动什么吗

@NexusLee 我确定我啥也没动,然后它自己就好了。所以我猜可能是网络不稳定唉。我是在实验室服务器上的anaconda上装的,我弄成功的是cpu版本的tensorflow1.11.0,gpu版本tensorflow的我后来没弄。
另外,我在katacoda上测试dockerfile的时候,不会报zmq这个错误,但是会在最后一步 read and listening的时候出不来就卡住了。

@zyj008 好的,明天我试试 1.11 版本

no, the problem is consistently reproduced.
need create dir and export to env
export ZEROMQ_SOCK_TMP_DIR=/tmp/zmq
link: https://sanidem.home.blog/tag/docker/

@IDIDIR I tried it. I think it's a problem with old tmp dir

i encounter the same problem, how did you guys solved it? help!!!!

i solved this at docker option.
I think this problem caused by docker's permission. add privileged docker-option.

no, the problem is consistently reproduced.
need create dir and export to env
export ZEROMQ_SOCK_TMP_DIR=/tmp/zmq
link: https://sanidem.home.blog/tag/docker/

屏幕快照 2020-08-19 10 18 15
Hi
It seems like the link is a private site.
Can u share the solution here?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KODGV picture KODGV  ·  6Comments

kirdin picture kirdin  ·  3Comments

loretoparisi picture loretoparisi  ·  6Comments

k-oul picture k-oul  ·  7Comments

xpact picture xpact  ·  5Comments