knime-mpicbg / knime-scripting

knime-scripting includes scripting extensions for KNIME to integrate R, Matlab, Python and Groovy scripts. These extensions include a collection of nodes to develop and deploy templates in the respective languages.
https://github.com/knime-mpicbg/knime-scripting/wiki
Other
44 stars 25 forks source link

KNIME Analytics Platform prompts for proxy user and password on startup #109

Closed kickuth closed 2 years ago

kickuth commented 2 years ago

When starting the Analytics Platform with a proxy requiring authentication configured, the user will be prompted to enter proxy credentials:

image

(verify with e.g. Docker Hub: docker run -e SQUID_USERNAME=testuser -e SQUID_PASSWORD=pwtest -p 3128:3128 robhaswell/squid-authenticated)

This seems to be caused by file downloads from HERE. While the prompt is open, a call stack reveals what we are waiting on:

at de.mpicbg.knime.scripting.core.TemplateCache.pingURL(TemplateCache.java:404)
at de.mpicbg.knime.scripting.core.TemplateCache.isFileReachable(TemplateCache.java:382)
at de.mpicbg.knime.scripting.core.TemplateCache.addTemplateFile(TemplateCache.java:126)
at de.mpicbg.knime.scripting.core.TemplateCache.addTemplatesFromPref(TemplateCache.java:105)
at de.mpicbg.knime.scripting.core.utils.ScriptingUtils.loadTemplateCache(ScriptingUtils.java:39)

depending on the installed plugin either:

at de.mpicbg.knime.scripting.python.PythonScriptingBundleActivator.start(PythonScriptingBundleActivator.java:67)
at de.mpicbg.knime.scripting.r.R4KnimeBundleActivator.start(R4KnimeBundleActivator.java:68)

I hope it is possible to avoid the downloads or only trigger them once the proxy user/password information can be retrieved from e.g. the eclipse store.

kickuth commented 2 years ago

Just noticed that these downloads are likely also made by the other scripting extensions.

Any idea, how to prevent this? Not all proxies return information (see screenshot), so that inexperienced AP users in companies get this (to them) cryptic startup prompt and can't continue.

image

niederle commented 2 years ago

Thank you for reporting the issue. I'll give it a look as soon as possible.

bernd-wiswedel commented 2 years ago

I need to bump this up again. There are users having proxy configurations and their KNIME installation would not start up because of this.

I think the proper solution is to defer this line in PythonScriptingBundleActivator to the latest time possible (i.e. when the nodes use/need the templates, i.e. pull from the cache lazily).

niederle commented 2 years ago

@bernd-wiswedel I wanted to put it into the first configuration call of one of the nodes. But I realized when working with the SDK KNIME loads a previously open workflow which also means that the configuration of 'configured' nodes is called during startup. Would this be an issue or does the Welcome-page always prevent it? I am not sure about this.

bernd-wiswedel commented 2 years ago

I think that would be acceptable given that the user is using nodes from the scripting extension. Also, as you mentioned, the workflows only get loaded when the welcome page is closed (this might change in the future but that's a discussion for another time).

On a related note, I think there is currently no timeout when fetching the scripts -- that's something to change.

You can reproduce this by setting up a local proxy container (see @kickuth 's comment above) and configure KNIME's proxy configuration (File -> Preferences -> General -> Network Settings) to use that proxy by provide the wrong password. Upon restart, KNIME will freeze indefinitely.

niederle commented 2 years ago

@bernd-wiswedel

On a related note, I think there is currently no timeout when fetching the scripts -- that's something to change.

There should be a timeout. Without any network connection KNIME will start without problems. I'm pretty sure that this has been tested from my side.

You can reproduce this by setting up a local proxy container (see @kickuth 's comment above) and configure KNIME's proxy configuration (File -> Preferences -> General -> Network Settings) to use that proxy by provide the wrong password. Upon restart, KNIME will freeze indefinitely.

I cannot reproduce the freezing. When setting a proxy with a wrong password, I get another dialog which prompts for username and password. Then providing the correct credentials would solve the issue. I am working on a Mac. I have not tested it on other OS. On which operating system did this issue occur?

bernd-wiswedel commented 2 years ago

I'm on Linux. I can't currently reproduce either ( :-( ).

(Happy to validate your (other) changes once they are made.)

niederle commented 2 years ago

@bernd-wiswedel

Feel free to test my solution on our trunk build. I'm happy about feedback.

bernd-wiswedel commented 2 years ago

I can confirm the behavior is as expected now. KNIME starts without issues and a connection is (attempted to be) established only when I interact with the nodes.

I noticed that the extension is not signed (which I guess is known for trunk/master builds). I followed the instructions here, subsection "Nightly Builds".

Also, I assume you will have to take additional steps in order to make this fix available in the next iteration of KNIME AP (4.7). Tagging @gab1one here so that he's aware of it. (Release branch must not be copied but a new one needs to created off of master?)

Thank you.