UnusualAlpha / ib-gateway-docker

Docker image with IB Gateway and IBC
MIT License
235 stars 95 forks source link

Address already in use #53

Open akh64bit opened 1 year ago

akh64bit commented 1 year ago

The scripts runs fine. However, If I change the config.ini.tmpl and make it auto-start at a fixed time everyday by adding the following lines, I get the error which is shown in the logs. These lines were added under "4. TWS Auto-Closedown" AutoLogoffTime= AutoRestartTime=10:00 PM The logs are shown below. 2023-01-03 14:22:59:252 IBC: Setting ReadOnlyApi ib-gateway_1  | 2023-01-03 14:22:59:321 IBC: Read-Only API checkbox is now set to: false ib-gateway_1  | 2023-01-03 14:22:59:321 IBC: Setting Auto restart time ib-gateway_1  | 2023-01-03 14:22:59:341 IBC: Auto restart time set to 10:00 PM ib-gateway_1  | 2023-01-03 14:22:59:341 IBC: Performing port configuration ib-gateway_1  | 2023-01-03 14:22:59:349 IBC: TWS API socket port was set to 4001 ib-gateway_1  | 2023-01-03 14:22:59:350 IBC: TWS API socket port now set to 4000 ib-gateway_1  | 2023-01-03 14:22:59:350 IBC: Click button: OK ib-gateway_1  | Forking :::4000 onto [0.0.0.0:4001](http://0.0.0.0:4001/) ib-gateway_1  | 2023/01/03 14:23:15 socat[229] E bind(5, {AF=2 [0.0.0.0:4001](http://0.0.0.0:4001/)}, 16): Address already in use

efernandesng commented 1 year ago

Hi @akh64bit,

Interesting, I'll take a look at that.

akh64bit commented 1 year ago

Thanks @efernandesng. Please let me know if you know any other details.

akh64bit commented 1 year ago

Any update on this?

johnjohnk2 commented 10 months ago

I have the same issue here ... @akh64bit do you have any update on this ?

johnjohnk2 commented 10 months ago

@akh64bit I ve found the solution and i will make a PR

mprusinski commented 6 months ago

We have similar problem (Address already in use):

2024-05-17 11:42:24:564 IBC: TWS API socket port was set to 4002 2024-05-17 11:42:24:564 IBC: TWS API socket port now set to 4000 2024-05-17 11:42:24:564 IBC: Setting Auto restart time 2024-05-17 11:42:24:616 IBC: Auto restart time set to 04:00 AM 2024-05-17 11:42:24:685 IBC: detected dialog entitled: Warning; event=Lost focus 2024-05-17 11:42:24:686 IBC: detected dialog entitled: Warning; event=Deactivated 2024-05-17 11:42:24:686 IBC: detected dialog entitled: Warning; event=Closed 2024-05-17 11:42:24:715 IBC: Configuration tasks completed 2024-05-17 11:42:24:715 IBC: Click button: OK Forking :::4000 onto 0.0.0.0:4002 2024/05/17 11:42:24 socat[291] E bind(5, {AF=2 0.0.0.0:4002}, 16): Address already in use 2024-05-17 11:42:24:987 IBC: detected dialog entitled: Pending Tasks; event=Closed 2024-05-17 11:42:25:024 IBC: detected dialog entitled: IB Gateway; event=Opened 2024-05-17 11:42:25:027 IBC: Click button: OK 2024-05-17 11:42:25:168 IBC: detected dialog entitled: IB Gateway; event=Activated 2024-05-17 11:42:25:188 IBC: detected dialog entitled: IB Gateway; event=Focused 2024-05-17 11:42:25:189 IBC: detected dialog entitled: IB Gateway; event=Lost focus 2024-05-17 11:42:25:191 IBC: detected dialog entitled: IB Gateway; event=Deactivated 2024-05-17 11:42:25:216 IBC: detected dialog entitled: IB Gateway; event=Closed

After running ib-gateway I have manually run the socat TCP-LISTEN:4002,fork TCP:127.0.0.1:4000 command inside the container and it succeded. I see there is constant 30s delay before running this command - is it possible to move this timeout to env variable, so it could be changed on demand? Probably this would make a pretty good workaround before issue is fixed.