grocy/grocy-desktop

Bug: ArgumentException - Item has already been added. Key in dictionary: 'PHP_FCGI_MAX_REQUESTS'

sunnyd24 opened this issue · 12 comments

  • Describe the bug as detailed as possible by providing the exact steps how to reproduce it:
    1. Download & Install "grocy-desktop_2.7.0.msi" on Windows 11
    2. Choose location to install "D:\00 grocy-desktop"and press next.
    3. Desktop app opens and is configuring, and stops at "ToolStripStatusLabel_ExternalAccessInfo".
    4. Error pops up with "ArgumentException - Item has already been added. Key in dictionary: 'PHP_FCGI_MAX_REQUESTS'." See screenshot below.
    5. No other buttons in GUI work and all present unhandled error occurred.

Screenshot 2023-09-15 135411

ArgumentException

Item has already been added. Key in dictionary: 'PHP_FCGI_MAX_REQUESTS' Key being added: 'PHP_FCGI_MAX_REQUESTS'

at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add) at GrocyDesktop.Management.PhpManager.Start() at GrocyDesktop.FrmMain.SetupPhpFastCgiServer() at GrocyDesktop.FrmMain.<FrmMain_Shown>d__34.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

berrnd commented

Grocy Desktop is maintained at grocy/grocy-desktop, so first moving this to the correct place...

berrnd commented

The dictionary item in question is added exactly one time, there:

environmentVariables.Add("PHP_FCGI_MAX_REQUESTS", "0");

So I have no idea how to get that error. And also a duplicate of #42 and #39. Not reproducible by the steps provided there, still not reproducible by the steps provided here - I can only fix reproducible issues.

@berrnd Thanks for moving this to grocy-desktop and letting me know of the other two closed bug reports, explains when I searched in issues in grocy I didn't see them!

I appreciate you can't help/fix without reproducing this. I have disabled Windows Firewall and Windows Defender, neither of these have resolved the issue.
For reference, I am using Windows 11 Pro, Version 10.0.22621 Build 22621, x64,

As I am going to have to figure this out on my own, please could you provide a little guidance?
I have read https://github.com/grocy/grocy-desktop#what-happens-on-start

I have noticed that several processes are run when running grocy-desktop from shortcut, see attached
screenshot.

Screenshot 2023-09-15 164400

The processes I see are:

  • php.exe
  • conhost.exe
  • grocy-desktop.exe.

Am I missing nginx.exe in process list and/or anything else looking odd?

I have force closed the process php.exe only, and that makes conhost.exe disappear too.
Grocy-desktop still behaves just like it did before with "unhandled error occurred" dialogs. So something fundamental that grocy-desktop needs to communicate with is not there, maybe the missing nginx.exe?

berrnd commented

So something fundamental that grocy-desktop needs to communicate with is not there, maybe the missing nginx.exe?

I don't really get how you came to this conclusion - again: The error message clearly indicates that it's about adding a duplicate dictionary item. A dictionary is technically a list of key/value pairs, where of course the keys need to be unique across the list. The item in question (with key PHP_FCGI_MAX_REQUESTS) is exactly added once (there), as already mentioned above.

I can't guide you without having any clue at all what's going on / without having something reproducible, unfortunately I'm not a magician. All that is nothing new and already mentioned in the duplicate requests.

berrnd commented

Am I missing nginx.exe in process list

The PHP process manager needs naturally to start first, that crashes grocy-desktop - so no real surprise that nginx is not started then.

berrnd commented

Even I can't reproduce it and have no explanation how that can happen at all, I've added a "only add the key if not already done"-check just now in b8d8fb4.

Feel free to test it, in the attached ZIP is a modified v2.7.0 grocy-desktop.exe including this change:

grocy-desktop.zip

berrnd commented

Is there a way to debug php, i.e. manually run php.exe with config in CLI

Of course technically everything is possible, Grocy Desktop does nothing else and auto-manages everything needed to run Grocy. But this error is clearly not about (or "in") PHP.

Sorry, but it doesn't sound like you really understand the technical stuff related to that all, so I doubt it's anything else than wasting time diving more into the technical details.

Even I can't reproduce it and have no explanation how that can happen at all, I've added a "only add the key if not already done"-check just now in b8d8fb4.

Feel free to test it, in the attached ZIP is a modified v2.7.0 grocy-desktop.exe including this change:

grocy-desktop.zip

I have tried this build and it gets to "preparing grocy", and then shows a unhandled error occurred dialog:
Screenshot 2023-09-15 181221

On trying to close the grocy-desktop window (via the x), it shows:
Screenshot 2023-09-15 181028

Of course technically everything is possible, Grocy Desktop does nothing else and auto-manages everything needed to run Grocy. But this error is clearly not about (or "in") PHP.

Sorry, but it doesn't sound like you really understand the technical stuff related to that all, so I doubt it's anything else than wasting time diving more into the technical details.

That's not very helpful advice, I never claimed to be a software expert but I am investigating this as two other bug reports, and now mine as third is unsolved/not reproducible. Of course it is NOT your fault that they can't be reproduced and therefore fixed, but there is definitely some issue that is common to at least 3 users that have reported. If you don't want to support in investigating this bug, just say so.

If you do want to support then it would be much appreciated, as I won't be the last person submitting a bug report like this.
So it looks like an error when trying to setup and start PHP server in SetupPhpFastCgiServer and failing where you add an environment variable, would you like guide me through any debugging steps to get more information on why this happens?

berrnd commented

Everything related has already been said, even with links to code references - don't know what you expected I should do more. In any case I'm out here now unless something reproducible is provided. I can't invest hours (for free) into each and every individual problem, sorry.

No problem, thanks for your efforts anyway!