ib-gateway-docker icon indicating copy to clipboard operation
ib-gateway-docker copied to clipboard

Address already in use

Open akh64bit opened this issue 2 years ago • 6 comments

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

akh64bit avatar Jan 03 '23 14:01 akh64bit

Hi @akh64bit,

Interesting, I'll take a look at that.

efernandesng avatar Jan 08 '23 16:01 efernandesng

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

akh64bit avatar Jan 09 '23 02:01 akh64bit

Any update on this?

akh64bit avatar Feb 17 '23 23:02 akh64bit

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

johnjohnk2 avatar Jan 12 '24 21:01 johnjohnk2

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

johnjohnk2 avatar Jan 22 '24 11:01 johnjohnk2

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.

mprusinski avatar May 17 '24 12:05 mprusinski