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

Cannot post Earn offer due to port bind issue #118

Open
sethforprivacy opened this issue Feb 13, 2024 · 6 comments
Open

Cannot post Earn offer due to port bind issue #118

sethforprivacy opened this issue Feb 13, 2024 · 6 comments

Comments

@sethforprivacy
Copy link

Even though I am not binding any ports externally, when trying to post an offer I get the following error each time and never see my offer appear on the orderbook:

2024-02-13 11:49:25,328 [INFO]  JoinMarket 0.9.10
2024-02-13 11:49:25,331 [INFO]  Attempting to start onion service on port: 5222 ...
2024-02-13 11:49:27,354 [INFO]  Announcing fidelity bond coin REDACTED:0
2024-02-13 11:49:27,354 [INFO]  offerlist=[{'oid': REDACTED, 'ordertype': 'REDACTED', 'minsize': REDACTED, 'maxsize': REDACTED, 'txfee': REDACTED, 'cjfee': 'REDACTED'}]
Unhandled error in Deferred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/twisted/internet/defer.py", line 763, in _startRunCallbacks
    self._runCallbacks()
  File "/usr/local/lib/python3.9/dist-packages/twisted/internet/defer.py", line 857, in _runCallbacks
    current.result = callback(  # type: ignore[misc]
  File "/src/jmbase/jmbase/twisted_utils.py", line 225, in onion_listen
    return onion_endpoint.listen(self.proto_factory)
  File "/usr/local/lib/python3.9/dist-packages/twisted/internet/endpoints.py", line 509, in listen
    return defer.execute(
--- <exception caught here> ---
  File "/usr/local/lib/python3.9/dist-packages/twisted/internet/defer.py", line 163, in execute
    result = callable(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/twisted/internet/posixbase.py", line 565, in listenTCP
    p.startListening()
  File "/usr/local/lib/python3.9/dist-packages/twisted/internet/tcp.py", line 1336, in startListening
    raise CannotListenError(self.interface, self.port, le)
twisted.internet.error.CannotListenError: Couldn't listen on 127.0.0.1:8080: [Errno 98] Address already in use.

Docker Compose:

 32   jam:
 33     container_name: jam
 34     image: ghcr.io/joinmarket-webui/jam-standalone:latest
 35     restart: unless-stopped
 36     environment:
 37       JM_RPC_HOST: "1.2.3.4"
 38       JM_RPC_PORT: "8332"
 39       JM_RPC_USER: "REDACTED"
 40       JM_RPC_PASSWORD: "REDACTED"
 41       APP_USER: "REDACTED"
 42       APP_PASSWORD: "REDACTED"
 43       ENSURE_WALLET: "true"
 44       REMOVE_LOCK_FILES: "true"
 45       RESTORE_DEFAULT_CONFIG: "true"
 46     volumes:
 47       - jmdatadir:/root/.joinmarket
@sethforprivacy
Copy link
Author

Note that I was able to find a workaround by setting onion_serving_port manually to a different port:

JM_ONION_SERVING_PORT: "8181"

I'm not exactly sure what this is conflicting with but it must be internal to the Standalone image as the port isn't being exposed at all to the host.

@theborakompanioni
Copy link
Collaborator

theborakompanioni commented Feb 20, 2024

Hey @sethforprivacy, thanks for the detailed report!
Please excuse the delay in replying.

I cannot quite wrap my head around this issue, especially since changing the port solves the issue.
From the docker-compose content, it seems you have other services defined?
May I ask what network is used? My silly guess would be that it started with network "host" and you have something running on port 8080 on your local machine.. but that would probably be too obvious.

There is nothing else that should bind to 8080 inside the image, so another case might be a bug in JM (not unbinding the port) - have you had a maker running before?

@sethforprivacy
Copy link
Author

Hey @sethforprivacy, thanks for the detailed report! Please excuse the delay in replying.

I cannot quite wrap my head around this issue, especially since changing the port solves the issue. From the docker-compose content, it seems you have other services defined? May I ask what network is used? My silly guess would be that it started with network "host" and you have something running on port 8080 on your local machine.. but that would probably be too obvious.

There is nothing else that should bind to 8080 inside the image, so another case might be a bug in JM (not unbinding the port) - have you had a maker running before?

I wish it was that simple :) I do not have any networks specified in the docker compose file, and as you can see the service here isn't exposing any ports either. As such there is no way it could conflict with other running services as the ports are never mapped to the host in any way and remain only internal to the JAM container.

I'm pretty much at a loss to what is happening, so assume it's something in JM/JAM that I don't understand!

@theborakompanioni
Copy link
Collaborator

Hey @sethforprivacy, thanks for the detailed report! Please excuse the delay in replying.
I cannot quite wrap my head around this issue, especially since changing the port solves the issue. From the docker-compose content, it seems you have other services defined? May I ask what network is used? My silly guess would be that it started with network "host" and you have something running on port 8080 on your local machine.. but that would probably be too obvious.
There is nothing else that should bind to 8080 inside the image, so another case might be a bug in JM (not unbinding the port) - have you had a maker running before?

I wish it was that simple :) I do not have any networks specified in the docker compose file, and as you can see the service here isn't exposing any ports either. As such there is no way it could conflict with other running services as the ports are never mapped to the host in any way and remain only internal to the JAM container.

I'm pretty much at a loss to what is happening, so assume it's something in JM/JAM that I don't understand!

So, from what I hear, it seems this happens sometimes when starting a maker via the api. It appears that JM does not cleanly unbind the port. There is a new version available (v0.9.11) which is included in the new standalone image (v0.2.0-clientserver-v0.9.11).

However, it should also have this problem when you choose another port, like you did as a workaround.
Question is still, if this happens immediately on the first start of a maker?

Coincidentally, there is also a discussion in the JM group about this. I let you know what the outcomes are.
Thanks so much for reporting @sethforprivacy 🙏

@sethforprivacy
Copy link
Author

Thanks for the details! Once I set a manual port I haven't had an issue with starting the maker but I also haven't been testing nearly as much since I opened the issue here.

Will keep an eye out for the resolution, and will test the new JAM without setting a manual port and see what happens!

@kristapsk
Copy link

kristapsk commented Feb 26, 2024

another case might be a bug in JM (not unbinding the port)

If that's the case, restarting jmwalletd.py process should solve it.

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

3 participants