QingdaoU / OnlineJudgeDeploy

537 stars 370 forks source link

无法登陆 #45

Open jerrywcy opened 4 years ago

jerrywcy commented 4 years ago

我在服务器上构建的,构建没有出问题,不过我是把80端口改成了1234端口。

访问也是好的,但是一登录就提示server error

如图: image

网址为http://oj.wgnfls.xyz:1234

这是log文件:

judge_server.log: https://raw.githubusercontent.com/jerrywcy/webdisk/master/judge_server.log

gunicorn.log:

[2020-03-09 04:46:39 +0000] [6] [INFO] Starting gunicorn 19.9.0
[2020-03-09 04:46:39 +0000] [6] [INFO] Listening at: http://0.0.0.0:8080 (6)
[2020-03-09 04:46:39 +0000] [6] [INFO] Using worker: threads
[2020-03-09 04:46:39 +0000] [16] [INFO] Booting worker with pid: 16
[2020-03-09 04:46:39 +0000] [18] [INFO] Booting worker with pid: 18
virusdefender commented 4 years ago

看看 server 的日志,你贴的是 judge server 的吧

jerrywcy commented 4 years ago

我又查看了一下 /OnlineJudgeDeploy/data/backend/log里的dramatiq.log不停的输出什么

[2020-03-11 14:26:00] - [CRITICAL] - [dramatiq.worker.ConsumerThread(default.DQ):237]  - Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.
[2020-03-11 14:26:00] - [ERROR] - [sentry.errors.uncaught:712]  - ['Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.']
b"['Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.']"
[2020-03-11 14:26:00] - [INFO] - [dramatiq.worker.ConsumerThread(default.DQ):249]  - Restarting consumer in 3.00 seconds.
[2020-03-11 14:26:02] - [CRITICAL] - [dramatiq.worker.ConsumerThread(default):237]  - Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.
[2020-03-11 14:26:02] - [ERROR] - [sentry.errors.uncaught:712]  - ['Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.']
b"['Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.']"
[2020-03-11 14:26:02] - [INFO] - [dramatiq.worker.ConsumerThread(default):249]  - Restarting consumer in 3.00 seconds.
[2020-03-11 14:26:04] - [CRITICAL] - [dramatiq.worker.ConsumerThread(default.DQ):237]  - Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.
[2020-03-11 14:26:04] - [ERROR] - [sentry.errors.uncaught:712]  - ['Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.']
b"['Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.']"
[2020-03-11 14:26:04] - [INFO] - [dramatiq.worker.ConsumerThread(default.DQ):249]  - Restarting consumer in 3.00 seconds.
[2020-03-11 14:26:06] - [CRITICAL] - [dramatiq.worker.ConsumerThread(default):237]  - Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.
[2020-03-11 14:26:06] - [INFO] - [dramatiq.worker.ConsumerThread(default):249]  - Restarting consumer in 3.00 seconds.
[2020-03-11 14:26:11] - [ERROR] - [sentry.errors:690]  - Sentry responded with an error: <urlopen error [Errno -3] Try again> (url: https://sentry.io/api/263057/store/)
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/urllib/request.py", line 1317, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/usr/local/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.7/http/client.py", line 966, in send
    self.connect()
  File "/usr/local/lib/python3.7/site-packages/raven/utils/http.py", line 31, in connect
    timeout=self.timeout,
  File "/usr/local/lib/python3.7/socket.py", line 707, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/local/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/raven/transport/threaded.py", line 165, in send_sync
    super(ThreadedHTTPTransport, self).send(url, data, headers)
  File "/usr/local/lib/python3.7/site-packages/raven/transport/http.py", line 43, in send
    ca_certs=self.ca_certs,
  File "/usr/local/lib/python3.7/site-packages/raven/utils/http.py", line 66, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.7/urllib/request.py", line 525, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.7/urllib/request.py", line 543, in _open
    '_open', req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.7/site-packages/raven/utils/http.py", line 46, in https_open
    return self.do_open(ValidHTTPSConnection, req)
  File "/usr/local/lib/python3.7/urllib/request.py", line 1319, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -3] Try again>
b'Sentry responded with an error: <urlopen error [Errno -3] Try again> (url: https://sentry.io/api/263057/store/)'
[2020-03-11 14:26:11] - [ERROR] - [sentry.errors.uncaught:712]  - ['Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.']
[2020-03-11 14:26:22] - [CRITICAL] - [dramatiq.worker.ConsumerThread(default.DQ):237]  - Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.
[2020-03-11 14:26:22] - [ERROR] - [sentry.errors.uncaught:712]  - ['Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.']
b"['Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.']"
[2020-03-11 14:26:22] - [INFO] - [dramatiq.worker.ConsumerThread(default.DQ):249]  - Restarting consumer in 3.00 seconds.
[2020-03-11 14:26:26] - [CRITICAL] - [dramatiq.worker.ConsumerThread(default.DQ):237]  - Consumer encountered a connection error: Error 113 connecting to oj-redis:6379. Host is unreachable.
[2020-03-11 14:26:26] - [INFO] - [dramatiq.worker.ConsumerThread(default.DQ):249]  - Restarting consumer in 3.00 seconds.

之类的东西

gunicorn.log则是

[2020-03-11 14:27:07] - [ERROR] - [sentry.errors.uncaught:712]  - ['Reconnecting to the database didn\'t help could not connect to server: Host is unreachable\n\tIs the server running on host "oj-postgres" (172.24.0.2) and accepting\n\tTCP/IP connections on port 5432?\n']

之类的东西

而nginx_error.log是

2020/03/11 13:58:43 [error] 230#230: *15 upstream timed out (110: Operation timed out) while reading response header from upstream, client: 121.237.212.251, server: _, request: "GET /api/website HTTP/1.1", upstream: "http://127.0.0.1:8080/api/website", host: "oj.wgnfls.xyz:10002", referrer: "http://oj.wgnfls.xyz:10002/"
2020/03/11 14:00:27 [error] 230#230: *34 upstream timed out (110: Operation timed out) while reading response header from upstream, client: 121.237.212.251, server: _, request: "GET /api/announcement HTTP/1.1", upstream: "http://127.0.0.1:8080/api/announcement", host: "oj.wgnfls.xyz:10002", referrer: "http://oj.wgnfls.xyz:10002/"
2020/03/11 14:00:27 [error] 230#230: *37 upstream timed out (110: Operation timed out) while reading response header from upstream, client: 121.237.212.251, server: _, request: "GET /api/website HTTP/1.1", upstream: "http://127.0.0.1:8080/api/website", host: "oj.wgnfls.xyz:10002", referrer: "http://oj.wgnfls.xyz:10002/"

我试着开了端口但也没用

这是docker-compose.yml:

version: "3"
services:

  oj-redis:
    image: redis:4.0-alpine
    container_name: oj-redis
    restart: always
    volumes:
      - ./data/redis:/data
    ports:
            - "0.0.0.0:6379:6378"

  oj-postgres:
    image: postgres:10-alpine
    container_name: oj-postgres
    restart: always
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=onlinejudge
      - POSTGRES_USER=onlinejudge
      - POSTGRES_PASSWORD=onlinejudge
    ports:
      - "0.0.0.0:5432:5443"

  judge-server:
    image: registry.cn-hangzhou.aliyuncs.com/onlinejudge/judge_server
    container_name: judge-server
    restart: always
    read_only: true
    cap_drop:
      - SETPCAP
      - MKNOD
      - NET_BIND_SERVICE
      - SYS_CHROOT
      - SETFCAP
      - FSETID
    tmpfs:
      - /tmp
    volumes:
      - ./data/backend/test_case:/test_case:ro
      - ./data/judge_server/log:/log
      - ./data/judge_server/run:/judger
    environment:
      - SERVICE_URL=http://judge-server:8080
      - BACKEND_URL=http://oj-backend:8000/api/judge_server_heartbeat/
      - TOKEN=CHANGE_THIS
      # - judger_debug=1
    ports:
      - "0.0.0.0:8080:8090"

  oj-backend:
    image: registry.cn-hangzhou.aliyuncs.com/onlinejudge/oj_backend
    container_name: oj-backend
    restart: always
    depends_on:
      - oj-redis
      - oj-postgres
      - judge-server
    volumes:
      - ./data/backend:/data
    environment:
      - POSTGRES_DB=onlinejudge
      - POSTGRES_USER=onlinejudge
      - POSTGRES_PASSWORD=onlinejudge
      - JUDGE_SERVER_TOKEN=CHANGE_THIS
      # - FORCE_HTTPS=1
      # - STATIC_CDN_HOST=cdn.oj.com
    ports:
      - "0.0.0.0:10002:8000"
      - "0.0.0.0:10003:1443"
SigalHu commented 4 years ago

和你一样的问题,我用的 CentOS,后来改成 Ubuntu 就没问题了