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

Odoo17 on ubuntu 22.04 error #408

Open
the-boxer opened this issue Jan 24, 2024 · 23 comments
Open

Odoo17 on ubuntu 22.04 error #408

the-boxer opened this issue Jan 24, 2024 · 23 comments

Comments

@the-boxer
Copy link

I have installed odoo17 community version using this script. Odoo seems to be working fine with "demo" data..
I only added a purchased app from the odoo app site called "odoo_import_image_url" which resulted in getting this error:
UncaughtClientError > TypeError
Uncaught Javascript Error > undefined is not an object (evaluating 'browser.navigator.clipboard.writeText')
UncaughtClientError > TypeError
Uncaught Javascript Error > undefined is not an object (evaluating 'browser.navigator.clipboard.writeText')

After restarting and trying to add a product url images odoo hangs for a while and shows this in the log file:

2024-01-24 14:50:13,613 607 ERROR tester odoo.http: Exception during request handling.
Traceback (most recent call last):
File "/odoo/odoo-server/addons/bus/websocket.py", line 836, in open_connection
socket = request.httprequest.environ['socket']
KeyError: 'socket'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/odoo/odoo-server/odoo/http.py", line 2150, in call
response = request._serve_db()
File "/odoo/odoo-server/odoo/http.py", line 1722, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/odoo/odoo-server/odoo/service/model.py", line 133, in retrying
result = func()
File "/odoo/odoo-server/odoo/http.py", line 1749, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/odoo/odoo-server/odoo/http.py", line 1866, in dispatch
return self.request.registry['ir.http']._dispatch(endpoint)
File "/odoo/odoo-server/addons/website/models/ir_http.py", line 235, in _dispatch
response = super()._dispatch(endpoint)
File "/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 222, in _dispatch
result = endpoint(**request.params)
File "/odoo/odoo-server/odoo/http.py", line 722, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/odoo/odoo-server/addons/bus/controllers/websocket.py", line 18, in websocket
return WebsocketConnectionHandler.open_connection(request)
File "/odoo/odoo-server/addons/bus/websocket.py", line 848, in open_connection
raise RuntimeError(
RuntimeError: Couldn't bind the websocket. Is the connection opened on the evented port (8072)?

The supplier of the app file assures me that this is a odoo installation error and not an error in their app.
I am not technical and have no way of solving this issue and need help.

@cliffkujala
Copy link

Are you running Odoo through NGINX Proxy, and have you tuned the config file so that it correctly uses Workers to enable gevent functions.

You can see more about this here https://www.odoo.com/documentation/17.0/administration/install/deploy.html#id8

@czambrano1997
Copy link

@the-boxer i have the same issue, maybe do you have the solution to fix that?

@czambrano1997
Copy link

Screenshot from 2024-05-01 11-42-22

@cliffkujala
Copy link

@czambrano1997 post your NGINX server block and your odoo-server.conf file contents here (make sure to remove any passwords or private address info.

@czambrano1997
Copy link

Odoo.conf

[options]
; This is the password that allows database operations:
admin_passwd = ******
csv_internal_sep = ,
data_dir = /var/lib/odoo
db_host = serverhost
db_port = 5432
db_user = odoo
db_password = odoo
db_name = False
addons_path = /mnt/oca-addons/....
http_port = 8069
logfile = /var/log/odoo/odoo.log
list_db = True
xmlrpc_port = 8069
#xmlrpc_interface = 0.0.0.0
gevent_port = 8072
#http_enable = True
proxy_mode = True
workers = 4
limit_memory_soft = 2147483648
limit_memory_hard = 4294967296
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200
max_cron_threads = 1

And my nginx file config

#odoo server
upstream odoo {
server 127.0.0.1:8066 weight=1 fail_timeout=300s;
}
upstream odoochat {
server 127.0.0.1:8077 weight=1 fail_timeout=300s;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

http -> https

server {
listen 80;
server_name subdomain1.domain.com;
rewrite ^(.*) https://$host$1 permanent;
}

server {
listen 443 ssl;
server_name subdomain1.domain.com;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;

SSL parameters

ssl_certificate /etc/ssl/certificate.crt;
ssl_certificate_key /etc/ssl/certificate.key;
ssl_session_timeout 30m;
ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;

log

access_log /var/log/nginx/subdomain1.access.log;
error_log /var/log/nginx/subdomain1.error.log;

Redirect requests to odoo backend server

location / {
# proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_pass http://odoo;
}

Redirect websocket requests to odoo gevent port

location /websocket {
proxy_redirect off;
proxy_pass http://odoochat;
}

common gzip

gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
gzip on;
}

@cliffkujala
Copy link

Try without both of these in your odoo config

http_port = 8069
xmlrpc_port = 8069

I am using only http_port = 8069 and the rest of my stuff looks similar to yours.

@czambrano1997
Copy link

I enable http_port = 8069

But the is same result => RuntimeError: Couldn't bind the websocket. Is the connection opened on the evented port (8072)?

Maybe the problem is located about i have configure 2 odoo instances with docker.
The first intance (odoo v15) configure has enable proxy_mode = True and don't have any error
But the second intances (odoo v17) is which has the problem about websocket

@cliffkujala
Copy link

Do you have the two instances on docker listening to the same outside ports. If one has already claimed 8072>8072 then you have to build the other docker container to listen to different outside ports, IE

8169>8069 for http
8172>8072 for gevent

@czambrano1997
Copy link

No, both containers have distinc bind ports
Odoo 1 (v15) => 8069:8069 8072:8072 - nginx file has /longpolling
Odoo 2 (v17) => 8066:8069 8077:8072 - nginx file has /websocket

@the-boxer
Copy link
Author

the-boxer commented May 2, 2024 via email

@AlexanderIgorovych
Copy link

In my case problem with web socket appeared in next case:

  1. I have removed the module (in a hard way). I just remove the folder with source code, and than restart the Odoo17.
    Module was still present in Odoo17.
  2. I have added next settings.
    limit_memory_hard = 20132659200
    limit_memory_soft = 1677721600
    limit_request = 8192
    limit_time_cpu = 3600
    limt_time_real = 7200
    limit_time_real_cron = -1
    max_cron_threads = 1
    workers = 25

to fix this warning: Skipping database because of modules to install/upgrade/remove,

as a result I have seen the web socket problem.

Solution was:

  1. Remove the settings, maybe I can keep some of them, but It is not the case for me, I have removed everyting.
    limit_memory_hard = 20132659200
    limit_memory_soft = 1677721600
    limit_request = 8192
    limit_time_cpu = 3600
    limt_time_real = 7200
    limit_time_real_cron = -1
    max_cron_threads = 1
    workers = 25

  2. and I have removed broken module from Odoo: Changed view to list , select the module, choose the Actions and hit delete.
    After that I don't see problem with websocket.

But I am doing it on my MacBook, not on Linux.

@IgorSantRocha
Copy link

Aqui o erro também estava dando por causa das configurações de:

limit_memory_hard = 20132659200
limit_memory_soft = 1677721600
limit_request = 8192
limit_time_cpu = 3600
limt_time_real = 7200
limit_time_real_cron = -1
max_cron_threads = 1
workers = 25

Resetei elas e voltou a funcionar

@ale900522
Copy link

As far as I know the issue was never solved. At the time I found a website with information to install odoo 17 on Debian. This worked straight off the bat. Recently I found several install tutorials for Ubuntu 22 and even 24 that work without any problems. Good luck Regards Boxer From: czambrano1997 @.> Date: Wednesday, 1 May 2024 at 18:33 To: Yenthe666/InstallScript @.> Cc: the boxer @.>, Mention @.> Subject: Re: [Yenthe666/InstallScript] Odoo17 on ubuntu 22.04 error (Issue #408) @the-boxerhttps://github.com/the-boxer i have the same issue, maybe do you have the solution to fix that? — Reply to this email directly, view it on GitHub<#408 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AIQC43YATYLMMJMO67W6XF3ZAEKMJAVCNFSM6AAAAABCI5DQF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBYG4ZTGMBQGA. You are receiving this because you were mentioned.Message ID: @.***>

I have the solution for docker-compose, docker swarm, if you want this I can send you, but I have the issue now on kubernetes.

@czambrano1997
Copy link

hi @ale900522, of course pls can you send me to my email or post the docker-compose to fix that problem?

@ale900522
Copy link

ale900522 commented Oct 4, 2024 via email

@nihal-infiniarc
Copy link

Hi
I am facing the same issue.
Previously i was using odoo15 with complete worker configuration.
But now i migrated the V15 to V17 on same server.
I have stopped the odoo15 service as well.
Also I checked the 8072 port (which is listening to python3.10 (for odoo17)).

But still getting the same error.

socket = request.httprequest._HTTPRequest__environ['socket']
KeyError: 'socket'

RuntimeError: Couldn't bind the websocket. Is the connection opened on the evented port (8072)?

Any solution?

@ale900522
Copy link

ale900522 commented Oct 23, 2024 via email

@ngocnv1712
Copy link

anyone have solution?

@ale900522
Copy link

ale900522 commented Nov 4, 2024

anyone have solution?
using docker-swarm with this compose are solution:

version: "3.9"
services:
  odoo:
    image: ${IMAGE_APP}:${IMAGE_TAG}
    networks:
      - traefik-swarm
      - databases-swarm
    volumes:
      - data:/var/lib/odoo
      - conf:/etc/odoo
      - addons:/mnt/extra-addons
    deploy:
      labels:
      # # global config       
        - "traefik.enable=true"
        - "traefik.docker.network=traefik-swarm"
      # # main routers 8069 web rule "/*"
        - "traefik.http.routers.odoo.tls=true"
        - "traefik.http.routers.odoo.entrypoints=https"
        - "traefik.http.routers.odoo.tls.certresolver=myresolver"
        - "traefik.http.routers.odoo.rule=Host(`${URL_DEPLOY}`)"               ## || Host(`${URL_SUBDOMAIN_DEPLOY}`)"
        - "traefik.http.routers.odoo.service=odoo@docker"
        - "traefik.http.routers.odoo.middlewares=gzip"
        - "traefik.http.services.odoo.loadbalancer.server.port=8069"
       # # main routers 8072 websocket rule "/websocket"
        - "traefik.http.routers.backend-websock.tls=true"
        - "traefik.http.routers.backend-websock.entrypoints=https"
        - "traefik.http.routers.backend-websock.tls.certresolver=myresolver"
        - "traefik.http.routers.backend-websock.rule=Path(`/websocket`) && Host(`${URL_DEPLOY}`)"
        - "traefik.http.routers.backend-websock.middlewares=upgradeheader,sslheader,gzip"
        - "traefik.http.routers.backend-websock.service=backend-websock@docker"
        - "traefik.http.services.backend-websock.loadbalancer.server.port=8072"
        #middleware database restrict study and fix#
        # - "traefik.http.routers.databases-access.tls=true"
        # - "traefik.http.routers.databases-access.entrypoints=https"
        # - "traefik.http.routers.databases-access.tls.certresolver=myresolver"
        # - "traefik.http.routers.databases-access.rule=Path(`/web/database`) && Host(`${URL_DEPLOY}`)"
        # - "traefik.http.routers.databases-access.service=databases-access@docker"
        # - "traefik.http.routers.databases-access.middlewares=gzip"
        # - "traefik.http.services.databases-access.loadbalancer.server.port=8069"
        # - "traefik.http.middlewares.allow_only.ipallowlist.sourceRange=5.5.5.5/32"
        # - "traefik.http.routers.databases-access.middlewares=allow_only"
        #middleware database restrict#
      # # upgrade headers 
        - "traefik.http.middlewares.upgradeheader.headers.customRequestHeaders.Upgrade=websocket"
        - "traefik.http.middlewares.upgradeheader.headers.customRequestHeaders.Connection=upgrade"
        - "traefik.http.middlewares.upgradeheader.headers.hostsproxyheaders=websocket,Upgrade"
        - "traefik.http.middlewares.upgradeheader.headers.forcestsheader=true"
        - "traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto=https"
      # # gzip compress
        - "traefik.http.middlewares.gzip.compress=true"
      placement:
        constraints: [node.role == worker]

volumes:
  data:
    external: true
  conf:
    external: true
  addons:
    external: true

networks:
  traefik-swarm:
    external: true
  databases-swarm:
    external: true

Remember in odoo.conf: gevent_port:8072 longpulling: disable http_port: 8069 I use this compose for my deployment in docker-swarm cluster and solve websocket error connection.

@ngocnv1712
Copy link

I'm using kubernetes deploy and istio for gateway but when have request /websocket?version=17.0-1 HTTP/1.1, throw error: RuntimeError: Couldn't bind the websocket. Is the connection opened on the evented port (8072)?

@ale900522
Copy link

ale900522 commented Nov 4, 2024

I'm using kubernetes deploy and istio for gateway but when have request /websocket?version=17.0-1 HTTP/1.1, throw error: RuntimeError: Couldn't bind the websocket. Is the connection opened on the evented port (8072)?

Ohh my friend for kubernetes the solution its different but the logic is same. I use traefikCRD like ingresscontroller and you need create ingressroute with this configuration, if you use only traefik for kubernetes with ingress class only adapt the ingressroute for ingress: I create two ingressroute one for https and one for websocket I send my solutions:

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  annotations:
    meta.helm.sh/release-name: demo-example
    meta.helm.sh/release-namespace: demo-example
  generation: 3
  labels:
    app.kubernetes.io/managed-by: Helm
    helm.toolkit.fluxcd.io/name: demo-example
    helm.toolkit.fluxcd.io/namespace: demo-example
  name: demo-example-https
  namespace: infra-example
spec:
  entryPoints:
  - websecure
  routes:
  - kind: Rule
    match: Host(`demo.example.com`)
    middlewares:
    - name: gzip-compress
    services:
    - name: demo-example-service
      namespace: demo-example
      port: 8069
  tls:
    certResolver: myresolver
    options:
      name: api-supertls
      namespace: infra-example
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  annotations:
    meta.helm.sh/release-name: demo-example
    meta.helm.sh/release-namespace: demo-example
  generation: 1
  labels:
    app.kubernetes.io/managed-by: Helm
    helm.toolkit.fluxcd.io/name: demo-example
    helm.toolkit.fluxcd.io/namespace: demo-example
  name: demo-example-websocket
  namespace: infra-example
spec:
  entryPoints:
  - websecure
  routes:
  - kind: Rule
    match: Host(`demo.example.com`) && Path(`/websocket`)
    middlewares:
    - name: upgradeheader
    - name: gzip-compress
    - name: sslheader
    services:
    - name: demo-example-websocket
      namespace: demo-example
      port: 8069
  tls:
    certResolver: myresolver
    options:
      name: api-supertls
      namespace: infra-example

and you need create middleware:

apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  generation: 1
  labels:
    kustomize.toolkit.fluxcd.io/name: kscommonapp
    kustomize.toolkit.fluxcd.io/namespace: flux-system
  name: sslheader
  namespace: infra-example
spec:
  headers:
    customRequestHeaders:
      X-Forwarded-Proto: https
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  generation: 1
  labels:
    kustomize.toolkit.fluxcd.io/name: kscommonapp
    kustomize.toolkit.fluxcd.io/namespace: flux-system
  name: upgradeheader
  namespace: infra-example
spec:
  headers:
    customRequestHeaders:
      Connection: upgrade
      Upgrade: websocket
    forceSTSHeader: true
    hostsProxyHeaders:
    - websocket
    - Upgrade
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  generation: 1
  labels:
    kustomize.toolkit.fluxcd.io/name: kscommonapp
    kustomize.toolkit.fluxcd.io/namespace: flux-system
  name: gzip-compress
  namespace: infra-example
spec:
  compress: {}

@ngocnv1712
Copy link

`
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: dth-crm-fe-gateway
namespace: topsim
spec:
selector:
istio: ingressgateway
servers:

  • port:
    number: 80
    name: http
    protocol: HTTP2
    hosts:
    • crm.test.com
      tls:
      httpsRedirect: true
  • port:
    number: 443
    name: https
    protocol: HTTPS
    hosts:
    • crm.test.com
      tls:
      mode: SIMPLE
      credentialName: dth-crm-fe-cert-secret # Use the certificate secret created by Cert-Manager
      minProtocolVersion: TLSV1_2
      maxProtocolVersion: TLSV1_3
      cipherSuites:
      • "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"
      • "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
      • "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"
      • "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
  • port:
    number: 8072
    name: websocket
    protocol: TCP
    hosts:
    • crm.test.com

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: dth-crm-fe-virtualservice
spec:
hosts:

  • crm.test.com
    gateways:
  • dth-crm-fe-gateway
    http:
  • match:
    • uri:
      prefix: /
      route:
      • destination:
        host: dth-crm-fe-svc.topsim.svc.cluster.local
        port:
        number: 8069
  • match:
    • uri:
      prefix: /websocket
      headers:
      Upgrade:
      exact: websocket
      route:
      • destination:
        host: dth-crm-fe-svc.topsim.svc.cluster.local
        port:
        number: 8072
        timeout: 600s
        tcp:
  • match:
    • port: 8072
      route:
    • destination:
      host: dth-crm-fe-svc.topsim.svc.cluster.local
      port:
      number: 8072

`
my gateway content, but not work

@ale900522
Copy link

` apiVersion: networking.istio.io/v1alpha3 kind: Gateway metadata: name: dth-crm-fe-gateway namespace: topsim spec: selector: istio: ingressgateway servers:

* port:
  number: 80
  name: http
  protocol: HTTP2
  hosts:
  
  * crm.test.com
    tls:
    httpsRedirect: true

* port:
  number: 443
  name: https
  protocol: HTTPS
  hosts:
  
  * crm.test.com
    tls:
    mode: SIMPLE
    credentialName: dth-crm-fe-cert-secret  # Use the certificate secret created by Cert-Manager
    minProtocolVersion: TLSV1_2
    maxProtocolVersion: TLSV1_3
    cipherSuites:
    
    * "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"
    * "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
    * "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"
    * "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"

* port:
  number: 8072
  name: websocket
  protocol: TCP
  hosts:
  
  * crm.test.com

apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: dth-crm-fe-virtualservice spec: hosts:

* crm.test.com
  gateways:

* dth-crm-fe-gateway
  http:

* match:
  
  * uri:
    prefix: /
    route:
    
    * destination:
      host: dth-crm-fe-svc.topsim.svc.cluster.local
      port:
      number: 8069

* match:
  
  * uri:
    prefix: /websocket
    headers:
    Upgrade:
    exact: websocket
    route:
    
    * destination:
      host: dth-crm-fe-svc.topsim.svc.cluster.local
      port:
      number: 8072
      timeout: 600s
      tcp:

* match:
  
  * port: 8072
    route:
  * destination:
    host: dth-crm-fe-svc.topsim.svc.cluster.local
    port:
    number: 8072

` my gateway content, but not work

Look odoo services not resolve websocket from internet odoo resolve this port internal, then your main endpoint always is port 8069 and target port for http://example.com/websocket is 8072 but your main endpoint is 8069 odoo internal do the redirection job.

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

No branches or pull requests

8 participants