Clinical-Genomics / scout

VCF visualization interface
https://clinical-genomics.github.io/scout
BSD 3-Clause "New" or "Revised" License
152 stars 46 forks source link

Delay and Scout mongodb connection fail in CLI when using --help flag #4965

Open Jakob37 opened 1 month ago

Jakob37 commented 1 month ago

Describe the bug

I think I have encountered a very minor bug. Nothing critical, and nothing blocking. Took me some time to figure out what was going on, so thought I would share (I initially thought there was some issue with our mongodb connection).

Our Scout container access mongodb through a specified host URL, meaning we run commands as such:

scout -h <mongo host> ...

When running Scout CLI commands using the --help flag, I get a 20s delay, and a warning about failed db connection, even when specifying non-localhost host through -h.

$ scout update --help -h <mongo host>
2024-10-18 07:47:45 5b391896585c scout.commands.base[532] INFO Running scout version 4.89.2
2024-10-18 07:44:01 5b391896585c scout.adapter.client[501] WARNING Database connection error:localhost:27017: [Errno 111] Connection refused (configured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms), Timeout: 30.0s, Topolog
y Description: <TopologyDescription id: 671211a38fda95c3a668b2db, topology_type: Unknown, servers: [<ServerDescription ('localhost', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('localhost:27017: [Errno 111] Connection refused (c
onfigured timeouts: socketTimeoutMS: 20000.0ms, connectTimeoutMS: 20000.0ms)')>]>
... Then successfully print the help text

Looks like it is attempting to find mongodb in localhost.

When running commands without --help flag it works fine. Also, running scout -h <host> update --help works fine.

I suspect scout --help will ignore any other base-level flags, and thus default -h to localhost.

To Reproduce

scout -h <host> --help

Expected behavior

Either no attempt to connect to Mongodb when using the --help flag, or respect the -h flag.

Additional context

In the moment of testing, I am running version 4.89.2.

northwestwitch commented 1 month ago

Ah yes, we are aware of this thing, see also #4408. It's still there in the latest version of scout. At one point we decided to not to fix it, but we can if it's very annoying

Jakob37 commented 1 month ago

Ah yes, we are aware of this thing, see also #4408. It's still there in the latest version of scout. At one point we decided to not to fix it, but we can if it's very annoying

Aha I see! Now when I am aware of it I don't think it will be an issue for me. Just wanted to notice you, to perhaps save future travellers some trouble.

So no need to fix it just for me!

northwestwitch commented 1 month ago

Aha I see! Now when I am aware of it I don't think it will be an issue for me. Just wanted to notice you, to perhaps save future travellers some trouble.

So no need to fix it just for me!

Ok, thanks anyway: it's always good to report a bug!

dnil commented 1 month ago

Thank you, and not easy to find in a closed issue. If I remember right, this was tied to some ancient workaround for getting config values from both the CLI-config and the scout server one. That dual loading is in for a rework (the CLI config is deprecated), as soon as we have any other pressing reason to change the API. Until now we are simply collecting those in a little pile on the kitchen table. 😸