Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Helper won't run on port 5000 or any port #727

Closed
graememullins opened this issue May 12, 2024 · 38 comments
Closed

[Bug]: Helper won't run on port 5000 or any port #727

graememullins opened this issue May 12, 2024 · 38 comments
Labels

Comments

@graememullins
Copy link

Platform

Windows

Operating system version

Windows 11

System architecture

Windows

Herd Version

1.1.0

PHP Version

8.3.7

Bug description

The helper won't run on port 5000, however the service is running in services.
Is there a fix for this, is there anything else I need to do to try another port?

I've tried port 5002, however this still doesn't work.

herd_port herd_helper

Also when I go to create a new project, it claims the project is created, however it doesn't get created.

I'm using my own /Projects folder on my D drive to hold any projects, not the herd folder in users.

Graeme

Steps to reproduce

Re installed Herd 3 times,
Started and stopped the service Herd Helper.
Windows updates
Herd updates

Relevant log output

No response

@issuelabeler issuelabeler bot added the windows label May 12, 2024
@sschlein
Copy link
Member

Could you please go to C:\ProgramData\Herd and open the services.json and add the debug flag there?

It should look like this:

{
	"herdHelperPort": 5000,
	"logLevel": "debug"
}

After that, please restart the service.

Then go to C:\Windows\System32\logs and open the latest HerdHelper log – if you think there is anything sensitive and you don't want to share it shere, please email it to [email protected] but there should usually just be an indicator if something wasn't able to start.

@sschlein sschlein added the needs more information Further information is requested label May 13, 2024
@graememullins
Copy link
Author

graememullins commented May 13, 2024

Hi,

I've made these updates and this is the log;

I've just updated my actual username with MYUSERNAME in the below, all other data is the same.

2024-05-13 14:29:49.064 +01:00 [INF] Application is shutting down...
2024-05-13 14:29:49.065 +01:00 [DBG] Hosting stopping
2024-05-13 14:29:49.067 +01:00 [INF] HTTP Server stopped.
2024-05-13 14:29:49.069 +01:00 [DBG] Hosting stopped
2024-05-13 14:29:50.817 +01:00 [DBG] Hosting starting
2024-05-13 14:29:50.865 +01:00 [INF] Config path: C:\ProgramData\Herd\service.json.
2024-05-13 14:29:50.868 +01:00 [INF] Application started. Hosting environment: Production; Content root path: C:\Users\MYUSERNAME.config\herd\bin
2024-05-13 14:29:50.869 +01:00 [DBG] Hosting started
2024-05-13 14:29:50.882 +01:00 [INF] Config file with port exists, using port: 5000.
2024-05-13 14:29:50.896 +01:00 [INF] HTTP Server started on http://localhost:5000/.

Status is still red in Herd on port 5000.

I was using and do have WAMP installed on this machine, but it's currently closed, and not running at the same time as Herd, I didn't want to remove WAMP until Herd is running ideally.

@sschlein sschlein removed the needs more information Further information is requested label May 13, 2024
@graememullins
Copy link
Author

I also have an issue, when I click the plus button in Herd to create a new project, the Laravel installer doesn't run, and just skips to the window which says the project is created.

Does this function also require the helper, are they connected?

herd-site-created-error

@EGYWEB-Mohamed
Copy link

I have had this problem, And I guess the problem caused by an anti-virus app because I wasn't have anti-virus and it was working fine once I install antivirus again it won't work again
am using Kaspersky

@graememullins
Copy link
Author

@EGYWEB-Mohamed - Which issue are you also getting, the helper one, or the create new site one?

@sschlein
Copy link
Member

I also have an issue, when I click the plus button in Herd to create a new project, the Laravel installer doesn't run, and just skips to the window which says the project is created.

Does this function also require the helper, are they connected?

herd-site-created-error

Does your terminal have the laravel and php binaries available? That usually happens if they are not in your path and Herd can't run laravel new projectname

@graememullins
Copy link
Author

graememullins commented May 16, 2024

It should do, I was using WAMP so would normally create a new project via the terminal, Is there any way to check.

@sschlein
Copy link
Member

What happens if you open Powershell and run laravel new does the installer start?

@graememullins
Copy link
Author

I get Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0". You are running 8.1.14. in phar://C:/Users/MYUSERNAME/.config/herd/bin/laravel.phar/vendor/composer/platform_check.php on line 24

@sschlein
Copy link
Member

It looks like you're running php 8.1 globally but the installer requires php 8.2 because that's the dependency for Laravel 11.

We definitely need to
Improve the error message but you can get around it by switching to php 8.2 or 8.3 globally.

Either via the UI or by running herd use 8.2

After that, the installier does it's work 🙂

@graememullins
Copy link
Author

graememullins commented May 16, 2024

Herd claims I'm using 8.3 globally.
herd-php-global

I still have WAMP installed, but not enabled, will this cause a clash?

@sschlein
Copy link
Member

It depends what's first in your $PATH variable. I assume that you get 8.1 when you run php -v

So my guess is that if you check your PATH variable in your environment variables, herd isn't the first one trying to link php and so it's the old one. That's a. It odd because the installer should place it first 🤔

Do your existing projects work if you clone them into a folder that's parked by herd? That's the one from the general settings.

@graememullins
Copy link
Author

Yeah that command claims 8.1.

herd-php-v

My pre-herd projects do work when herd is running and I use the open link, they're all listed now in sites.

@graememullins
Copy link
Author

Wamp was listed in the path, I've removed that and the new projects button works fine now, it's just the issue with herd helper remaining, but for now I can manually create the hosts file record.

@sschlein
Copy link
Member

Regarding the HerdHelper:

Could you please run sc.exe query HerdHelper and post the result to verify that it's running?

Does your username contain a space or special chars?

What happens if you change the port? There should be a popup requesting admin priviledges to restart it.

Does the Dumps and Mail features work for those who face the issue but also have Herd Pro?

@graememullins
Copy link
Author

Hi,

This is the results running on port 5000 and 5002.

SERVICE_NAME: HerdHelper
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0

When I change the port the pop-up shows but the same issue happens, as shown above I ran the same on port 5002.

Dumps and mail are both green, services with mysql also works fine.

Graeme

@sschlein
Copy link
Member

Could you please mail me the content of your hosts file to our support email address?

@graememullins
Copy link
Author

Hi,

I've just send this over,

Graeme

@graememullins
Copy link
Author

@sschlein What was the fix for this?

@sschlein
Copy link
Member

It's a duplicate not a permanent fix, sorry.

@graememullins
Copy link
Author

@sschlein Is herd helpers only job to create the URLs in the hosts file?

I've just been creating them manually for now, and it seems a workaround.

@sschlein
Copy link
Member

Yeah exactly. That's the only thing (writing to your hosts file) that requires admin privileges and using the helper allows us to run all other parts of the app with your normal user account. The helper exposes a rest endpoint that accepts your sites and creates the hosts entries based on that.

This is why I am wondering what intercepts these calls - for example the status call that displays the information if it's running.

@graememullins
Copy link
Author

Might it work, when you install Herd it tries maybe 5 pre-defined and common free ports.
Only if if fails on all 5, then a workaround option is given?

@sschlein
Copy link
Member

The problem with that is that this is curing a symptom instead of working with the root cause. Most people here have tried changing ports, the helper is running but the Herd app can't connect to it.

So there's a different problem that we need to solve.

@sschlein
Copy link
Member

@graememullins and others with the HerdHelper status in red while it's clearly running in your windows services app:

Can you please post the output of:

sc.exe query HerdHelper

and then

curl http://localhost:5000/status (or your port)

I have no idea why it could start on port 6000 if there is 5000 in your app. Did you try 6000 and then set it back to 5000 but ignored the popup for the restart? Restarting it from the system services or via command line should to the trick.

This needs an admin shell:

sc.exe stop HerdHelper
sc.exe start HerdHelper
sc.exe query HerdHelper

@sschlein
Copy link
Member

Could you all also do a ping localhost, ping 127.0.0.1 and ping ::1?

@graememullins
Copy link
Author

graememullins commented May 23, 2024

Output of sc.exe query HerdHelper

SERVICE_NAME: HerdHelper
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0

curl (port 5000)

{"message": "OK"}

Ping localhost

Pinging PCNAME [::1] with 32 bytes of data:
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms

Ping statistics for ::1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

Ping 127.0.0.1

Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

Ping ::1

Pinging ::1 with 32 bytes of data:
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms
Reply from ::1: time<1ms

Ping statistics for ::1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms

@graememullins
Copy link
Author

Also;

PS C:\WINDOWS\system32> sc.exe stop HerdHelper

SERVICE_NAME: HerdHelper
TYPE : 10 WIN32_OWN_PROCESS
STATE : 3 STOP_PENDING
(STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
PS C:\WINDOWS\system32> sc.exe start HerdHelper

SERVICE_NAME: HerdHelper
TYPE : 10 WIN32_OWN_PROCESS
STATE : 2 START_PENDING
(NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x7d0
PID : 49896
FLAGS :
PS C:\WINDOWS\system32> sc.exe query HerdHelper

SERVICE_NAME: HerdHelper
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
PS C:\WINDOWS\system32>

@sschlein
Copy link
Member

Unfortunately, that's all correct.

Can you please install this debug build? Download Herd Debug

This already has an updated HerdHelper and a new general setting with more logs.

@graememullins
Copy link
Author

graememullins commented May 24, 2024

Ok, that's installed now, latest log below, I tested on port 5002 as well.

2024-05-24 20:12:23.066 +01:00 [INF] Application is shutting down...
2024-05-24 20:12:23.067 +01:00 [DBG] Hosting stopping
2024-05-24 20:12:23.069 +01:00 [INF] HTTP Server stopped.
2024-05-24 20:12:23.071 +01:00 [DBG] Hosting stopped
2024-05-24 20:13:14.383 +01:00 [DBG] Hosting starting
2024-05-24 20:13:14.421 +01:00 [INF] Config path: C:\ProgramData\Herd\service.json.
2024-05-24 20:13:14.422 +01:00 [INF] Config file with port exists, using port: 5000.
2024-05-24 20:13:14.423 +01:00 [INF] Application started. Hosting environment: Production; Content root path: C:\Users\graememullins.config\herd\bin
2024-05-24 20:13:14.427 +01:00 [DBG] Hosting started
2024-05-24 20:13:14.430 +01:00 [INF] HTTP Server started on http://localhost:5000/.
2024-05-24 20:13:51.032 +01:00 [INF] Application is shutting down...
2024-05-24 20:13:51.032 +01:00 [DBG] Hosting stopping
2024-05-24 20:13:51.033 +01:00 [INF] HTTP Server stopped.
2024-05-24 20:13:51.035 +01:00 [DBG] Hosting stopped
2024-05-24 20:13:51.409 +01:00 [DBG] Hosting starting
2024-05-24 20:13:51.447 +01:00 [INF] Config path: C:\ProgramData\Herd\service.json.
2024-05-24 20:13:51.448 +01:00 [INF] Config file with port exists, using port: 5002.
2024-05-24 20:13:51.448 +01:00 [INF] Application started. Hosting environment: Production; Content root path: C:\Users\graememullins.config\herd\bin
2024-05-24 20:13:51.449 +01:00 [DBG] Hosting started
2024-05-24 20:13:51.455 +01:00 [INF] HTTP Server started on http://localhost:5002/.
2024-05-24 20:15:09.932 +01:00 [INF] Application is shutting down...
2024-05-24 20:15:09.932 +01:00 [DBG] Hosting stopping
2024-05-24 20:15:09.934 +01:00 [INF] HTTP Server stopped.
2024-05-24 20:15:09.936 +01:00 [DBG] Hosting stopped
2024-05-24 20:15:10.313 +01:00 [DBG] Hosting starting
2024-05-24 20:15:10.351 +01:00 [INF] Config path: C:\ProgramData\Herd\service.json.
2024-05-24 20:15:10.351 +01:00 [INF] Config file with port exists, using port: 5000.
2024-05-24 20:15:10.352 +01:00 [INF] Application started. Hosting environment: Production; Content root path: C:\Users\graememullins.config\herd\bin
2024-05-24 20:15:10.353 +01:00 [DBG] Hosting started
2024-05-24 20:15:10.360 +01:00 [INF] HTTP Server started on http://localhost:5000/.

@sschlein
Copy link
Member

Hey folks, can you please try this debug version? It logs way more data than previous version.

Download

  • Install debug version
  • Go to General settings and enable the HerdHelper debug mode
  • Restart Herd
  • Check the logs (linked at the general settings, click on the path to get there)
  • Also check the logs at %USERPROFILE%\AppData\Roaming\Herd\logs

You can either post the logs here or send them to [email protected] (and please mention this issue #727

@graememullins
Copy link
Author

When I installed this, I did get a prompt which said, failed to load/start herd helper.

Here it the output from the logs,

2024-05-31 16:03:23.890 +01:00 [DBG] Hosting stopping
2024-05-31 16:03:23.889 +01:00 [INF] Application is shutting down...
2024-05-31 16:03:23.923 +01:00 [INF] HTTP Server stopped.
2024-05-31 16:03:23.927 +01:00 [DBG] Hosting stopped
2024-05-31 16:03:36.465 +01:00 [DBG] Hosting starting
2024-05-31 16:03:36.506 +01:00 [INF] Config path: C:\ProgramData\Herd\service.json.
2024-05-31 16:03:36.507 +01:00 [INF] Config file with port exists, using port: 5000.
2024-05-31 16:03:36.508 +01:00 [INF] Application started. Hosting environment: Production; Content root path: C:\Users\graememullins.config\herd\bin
2024-05-31 16:03:36.509 +01:00 [DBG] Hosting started
2024-05-31 16:03:36.522 +01:00 [ERR] BackgroundService failed
System.Net.HttpListenerException (1232): The network location cannot be reached. For information about network troubleshooting, see Windows Help.
at System.Net.HttpListener.AddPrefixCore(String registeredPrefix)
at System.Net.HttpListener.AddAllPrefixes()
at System.Net.HttpListener.Start()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-05-31 16:03:36.528 +01:00 [FTL] The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted.
System.Net.HttpListenerException (1232): The network location cannot be reached. For information about network troubleshooting, see Windows Help.
at System.Net.HttpListener.AddPrefixCore(String registeredPrefix)
at System.Net.HttpListener.AddAllPrefixes()
at System.Net.HttpListener.Start()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-05-31 16:03:36.528 +01:00 [INF] Application is shutting down...
2024-05-31 16:03:36.528 +01:00 [DBG] Hosting stopping
2024-05-31 16:03:36.530 +01:00 [DBG] Hosting stopped

@sschlein
Copy link
Member

sschlein commented Jun 3, 2024

Hey folks, can you please try this NEW debug version?

This one should heal itself it the port is already in use, fix not existing hosts files, write to read-only hosts files and only use IPv6 in cases that this is properly configured on the host machine.

Download

  • Install debug version
  • Restart Herd
  • Also check the logs at %USERPROFILE%\AppData\Roaming\Herd\logs

You can either post the logs here or send them to [email protected]

Thanks for helping us with debugging.

@sschlein sschlein added the needs more information Further information is requested label Jun 4, 2024
@graememullins
Copy link
Author

graememullins commented Jun 4, 2024

I still get this error;

herd_failed_helper

Logs for you:

[2024-06-04 16:41:40.244] [error] HTTP Request Failed: {
message: 'connect ECONNREFUSED 127.0.0.1:5000',
name: 'Error',
stack: 'Error: connect ECONNREFUSED 127.0.0.1:5000\n' +
' at Function.from (C:\Program Files\Herd\resources\app.asar\node_modules\axios\dist\node\axios.cjs:837:14)\n' +
' at RedirectableRequest.handleRequestError (C:\Program Files\Herd\resources\app.asar\node_modules\axios\dist\node\axios.cjs:3083:25)\n' +
' at RedirectableRequest.emit (node:events:517:28)\n' +
' at ClientRequest. (C:\Program Files\Herd\resources\app.asar\node_modules\follow-redirects\index.js:38:24)\n' +
' at ClientRequest.emit (node:events:517:28)\n' +
' at Socket.socketErrorListener (node:_http_client:501:9)\n' +
' at Socket.emit (node:events:517:28)\n' +
' at emitErrorNT (node:internal/streams/destroy:151:8)\n' +
' at emitErrorCloseNT (node:internal/streams/destroy:116:3)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:82:21)',
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [ 'xhr', 'http' ],
transformRequest: [
'[function] function transformRequest(data, headers) {\n' +
" const contentType = headers.getContentType() || '';\n" +
" const hasJSONContentType = contentType.indexOf('application/json') > -1;\n" +
' const isObjectPayload = utils$1.isObject(data);\n' +
'\n' +
' if (isObjectPayload && utils$1.isHTMLForm(data)) {\n' +
' data = new FormData(data);\n' +
' }\n' +
'\n' +
' const isFormData = utils$1.isFormData(data);\n' +
'\n' +
' if (isFormData) {\n' +
' if (!hasJSONContentType) {\n' +
' return data;\n' +
' }\n' +
' return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;\n' +
' }\n' +
'\n' +
' if (utils$1.isArrayBuffer(data) ||\n' +
' utils$1.isBuffer(data) ||\n' +
' utils$1.isStream(data) ||\n' +
' utils$1.isFile(data) ||\n' +
' utils$1.isBlob(data)\n' +
' ) {\n' +
' return data;\n' +
' }\n' +
' if (utils$1.isArrayBufferView(data)) {\n' +
' return data.buffer;\n' +
' }\n' +
' if (utils$1.isURLSearchParams(data)) {\n' +
" headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);\n" +
' return data.toString();\n' +
' }\n' +
'\n' +
' let isFileList;\n' +
'\n' +
' if (isObjectPayload) {\n' +
" if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {\n" +
' return toURLEncodedForm(data, this.formSerializer).toString();\n' +
' }\n' +
'\n' +
" if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {\n" +
' const _FormData = this.env && this.env.FormData;\n' +
'\n' +
' return toFormData(\n' +
" isFileList ? {'files[]': data} : data,\n" +
' _FormData && new _FormData(),\n' +
' this.formSerializer\n' +
' );\n' +
' }\n' +
' }\n' +
'\n' +
' if (isObjectPayload || hasJSONContentType ) {\n' +
" headers.setContentType('application/json', false);\n" +
' return stringifySafely(data);\n' +
' }\n' +
'\n' +
' return data;\n' +
' }'
],
transformResponse: [
'[function] function transformResponse(data) {\n' +
' const transitional = this.transitional || defaults.transitional;\n' +
' const forcedJSONParsing = transitional && transitional.forcedJSONParsing;\n' +
" const JSONRequested = this.responseType === 'json';\n" +
'\n' +
' if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {\n' +
' const silentJSONParsing = transitional && transitional.silentJSONParsing;\n' +
' const strictJSONParsing = !silentJSONParsing && JSONRequested;\n' +
'\n' +
' try {\n' +
' return JSON.parse(data);\n' +
' } catch (e) {\n' +
' if (strictJSONParsing) {\n' +
" if (e.name === 'SyntaxError') {\n" +
' throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);\n' +
' }\n' +
' throw e;\n' +
' }\n' +
' }\n' +
' }\n' +
'\n' +
' return data;\n' +
' }'
],
timeout: 0,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
env: {
FormData: '[function] function FormData(options) {\n' +
' if (!(this instanceof FormData)) {\n' +
' return new FormData(options);\n' +
' }\n' +
'\n' +
' this._overheadLength = 0;\n' +
' this._valueLength = 0;\n' +
' this.valuesToMeasure = [];\n' +
'\n' +
' CombinedStream.call(this);\n' +
'\n' +
' options = options || {};\n' +
' for (var option in options) {\n' +
' this[option] = options[option];\n' +
' }\n' +
'}',
Blob: '[function] class Blob {\n' +
' /\n' +
' * @typedef {string|ArrayBuffer|ArrayBufferView|Blob} SourcePart\n' +
' */\n' +
'\n' +
' /
\n' +
' * @param {SourcePart[]} [sources]\n' +
' * @param {{\n' +
' * endings? : string,\n' +
' * type? : string,\n' +
' * }} [options]\n' +
' * @constructs {Blob}\n' +
' */\n' +
' constructor(sources = [], options) {\n' +
' if (sources === null ||\n' +
" typeof sources[SymbolIterator] !== 'function' ||\n" +
" typeof sources === 'string') {\n" +
" throw new ERR_INVALID_ARG_TYPE('sources', 'a sequence', sources);\n" +
' }\n' +
" validateDictionary(options, 'options');\n" +
' let {\n' +
" type = '',\n" +
" endings = 'transparent',\n" +
' } = options ?? kEmptyObject;\n' +
'\n' +
' endings = ${endings};\n' +
" if (endings !== 'transparent' && endings !== 'native')\n" +
" throw new ERR_INVALID_ARG_VALUE('options.endings', endings);\n" +
'\n' +
' let length = 0;\n' +
' const sources
= ArrayFrom(sources, (source) => {\n' +
' const { 0: len, 1: src } = getSource(source, endings);\n' +
' length += len;\n' +
' return src;\n' +
' });\n' +
'\n' +
' if (length > kMaxLength)\n' +
' throw new ERR_BUFFER_TOO_LARGE(kMaxLength);\n' +
'\n' +
' this[kHandle] = createBlob(sources, length);\n' +
' this[kLength] = length;\n' +
'\n' +
' type = ${type};\n' +
' this[kType] = RegExpPrototypeExec(disallowedTypeCharacters, type) !== null ?\n' +
" '' : StringPrototypeToLowerCase(type);\n" +
'\n' +
' // eslint-disable-next-line no-constructor-return\n' +
' return makeTransferable(this);\n' +
' }\n' +
'\n' +
' [kInspect](depth, options) {\n' +
' if (depth < 0)\n' +
' return this;\n' +
'\n' +
' const opts = {\n' +
' ...options,\n' +
' depth: options.depth == null ? null : options.depth - 1,\n' +
' };\n' +
'\n' +
' return Blob ${inspect({\n' + ' size: this.size,\n' + ' type: this.type,\n' + ' }, opts)};\n' +
' }\n' +
'\n' +
' kClone {\n' +
' const handle = this[kHandle];\n' +
' const type = this[kType];\n' +
' const length = this[kLength];\n' +
' return {\n' +
' data: { handle, type, length },\n' +
" deserializeInfo: 'internal/blob:ClonedBlob',\n" +
' };\n' +
' }\n' +
'\n' +
' [kDeserialize]({ handle, type, length }) {\n' +
' this[kHandle] = handle;\n' +
' this[kType] = type;\n' +
' this[kLength] = length;\n' +
' }\n' +
'\n' +
' /\n' +
' * @readonly\n' +
' * @type {string}\n' +
' */\n' +
' get type() {\n' +
' if (!isBlob(this))\n' +
" throw new ERR_INVALID_THIS('Blob');\n" +
' return this[kType];\n' +
' }\n' +
'\n' +
' /
\n' +
' * @readonly\n' +
' * @type {number}\n' +
' */\n' +
' get size() {\n' +
' if (!isBlob(this))\n' +
" throw new ERR_INVALID_THIS('Blob');\n" +
' return this[kLength];\n' +
' }\n' +
'\n' +
' /\n' +
' * @param {number} [start]\n' +
' * @param {number} [end]\n' +
' * @param {string} [contentType]\n' +
' * @returns {Blob}\n' +
' */\n' +
" slice(start = 0, end = this[kLength], contentType = '') {\n" +
' if (!isBlob(this))\n' +
" throw new ERR_INVALID_THIS('Blob');\n" +
' if (start < 0) {\n' +
' start = MathMax(this[kLength] + start, 0);\n' +
' } else {\n' +
' start = MathMin(start, this[kLength]);\n' +
' }\n' +
' start |= 0;\n' +
'\n' +
' if (end < 0) {\n' +
' end = MathMax(this[kLength] + end, 0);\n' +
' } else {\n' +
' end = MathMin(end, this[kLength]);\n' +
' }\n' +
' end |= 0;\n' +
'\n' +
' contentType = ${contentType};\n' +
' if (RegExpPrototypeExec(disallowedTypeCharacters, contentType) !== null) {\n' +
" contentType = '';\n" +
' } else {\n' +
' contentType = StringPrototypeToLowerCase(contentType);\n' +
' }\n' +
'\n' +
' const span = MathMax(end - start, 0);\n' +
'\n' +
' return createBlob(\n' +
' this[kHandle].slice(start, start + span),\n' +
' span,\n' +
' contentType);\n' +
' }\n' +
'\n' +
' /
\n' +
' * @returns {Promise}\n' +
' */\n' +
' arrayBuffer() {\n' +
' if (!isBlob(this))\n' +
" return PromiseReject(new ERR_INVALID_THIS('Blob'));\n" +
'\n' +
" // If there's already a promise in flight for the content,\n" +
" // reuse it, but only while it's in flight. After the cached\n" +
' // promise resolves it will be cleared, allowing it to be\n' +
' // garbage collected as soon as possible.\n' +
' if (this[kArrayBufferPromise])\n' +
' return this[kArrayBufferPromise];\n' +
'\n' +
' const job = new FixedSizeBlobCopyJob(this[kHandle]);\n' +
'\n' +
' const ret = job.run();\n' +
'\n' +
' // If the job returns a value immediately, the ArrayBuffer\n' +
' // was generated synchronously and should just be returned\n' +
' // directly.\n' +
' if (ret !== undefined)\n' +
' return PromiseResolve(ret);\n' +
'\n' +
' const {\n' +
' promise,\n' +
' resolve,\n' +
' reject,\n' +
' } = createDeferredPromise();\n' +
'\n' +
' job.ondone = (err, ab) => {\n' +
' if (err !== undefined)\n' +
' return reject(new AbortError(undefined, { cause: err }));\n' +
' resolve(ab);\n' +
' };\n' +
' this[kArrayBufferPromise] =\n' +
' SafePromisePrototypeFinally(\n' +
' promise,\n' +
' () => this[kArrayBufferPromise] = undefined);\n' +
'\n' +
' return this[kArrayBufferPromise];\n' +
' }\n' +
'\n' +
' /\n' +
' * @returns {Promise}\n' +
' */\n' +
' async text() {\n' +
' if (!isBlob(this))\n' +
" throw new ERR_INVALID_THIS('Blob');\n" +
'\n' +
' dec ??= new TextDecoder();\n' +
'\n' +
' return dec.decode(await this.arrayBuffer());\n' +
' }\n' +
'\n' +
' /
\n' +
' * @returns {ReadableStream}\n' +
' */\n' +
' stream() {\n' +
' if (!isBlob(this))\n' +
" throw new ERR_INVALID_THIS('Blob');\n" +
'\n' +
' const self = this;\n' +
' return new lazyReadableStream({\n' +
' async start() {\n' +
' this[kState] = await self.arrayBuffer();\n' +
' this[kIndex] = 0;\n' +
' },\n' +
'\n' +
' pull(controller) {\n' +
' if (this[kState].byteLength - this[kIndex] <= kMaxChunkSize) {\n' +
' controller.enqueue(new Uint8Array(this[kState], this[kIndex]));\n' +
' controller.close();\n' +
' this[kState] = undefined;\n' +
' } else {\n' +
' controller.enqueue(new Uint8Array(this[kState], this[kIndex], kMaxChunkSize));\n' +
' this[kIndex] += kMaxChunkSize;\n' +
' }\n' +
' },\n' +
' });\n' +
' }\n' +
'}'
},
validateStatus: '[function] function validateStatus(status) {\n' +
' return status >= 200 && status < 300;\n' +
' }',
headers: {
Accept: 'application/json, text/plain, /',
'User-Agent': 'axios/1.6.2',
'Accept-Encoding': 'gzip, compress, deflate, br'
},
method: 'get',
url: 'http://127.0.0.1:5000/status'
},
code: 'ECONNREFUSED',
status: null
}

@sschlein
Copy link
Member

sschlein commented Jun 4, 2024

I wonder why Herd is in C:\Program Files and not C:\Users\USER\AppData\Roaming\Herd 🤔 Is this a Win10 and Win11 difference or why could that happen?

Can you please download this version of the HerdHelper and install it manually? Download

To install it manually:

  1. Open a powershell as admin
  2. Run sc.exe stop HerdHelper (if it's there)
  3. Replace the HerdHelper.exe in %USERPROFILE%\.config\Herd\bin
  4. Run sc.exe start HerdHelper

If the HerdHelper service can't be started because it's not there yet, please do:

  1. sc.exe create HerdHelper binpath="path-to-HerdHelper.exe" (should be C:\Users\YOUR-USER\.config\Herd\bin\HerdHelper.exe
  2. Run sc.exe start HerdHelper

This should give us either better error messages during the setup or finally the logs that we need (or a working HerdHelper) at C:\Windows\System32\logs

I appreciate your patience and your help to debug this so that we can fix this once and for all.

@graememullins
Copy link
Author

I'm using Win11

I've tried all of the above and get;

SERVICE_NAME: HerdHelper
TYPE : 10 WIN32_OWN_PROCESS
STATE : 2 START_PENDING
(NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x7d0
PID : 2216
FLAGS :

Logs for you;

2024-06-04 16:38:34.327 +01:00 [DBG] Hosting starting
2024-06-04 16:38:34.378 +01:00 [INF] Config path: C:\ProgramData\Herd\service.json.
2024-06-04 16:38:34.379 +01:00 [INF] Config file with port exists, using port: 5000.
2024-06-04 16:38:34.380 +01:00 [INF] Application started. Hosting environment: Production; Content root path: C:\Users\graememullins.config\herd\bin
2024-06-04 16:38:34.381 +01:00 [DBG] Hosting started
2024-06-04 16:38:34.389 +01:00 [INF] IPv6 is supported. Added http://[::1]:5000/ to listener prefixes.
2024-06-04 16:38:34.391 +01:00 [ERR] An error occurred while starting the HTTP server: The network location cannot be reached. For information about network troubleshooting, see Windows Help.
2024-06-04 16:38:34.392 +01:00 [ERR] An error occurred: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
2024-06-04 16:38:34.392 +01:00 [ERR] BackgroundService failed
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
at System.Net.HttpListener.Stop()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-06-04 16:38:34.397 +01:00 [FTL] The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
at System.Net.HttpListener.Stop()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-06-04 16:38:34.397 +01:00 [INF] Application is shutting down...
2024-06-04 16:38:34.398 +01:00 [DBG] Hosting stopping
2024-06-04 16:38:34.400 +01:00 [DBG] Hosting stopped
2024-06-04 18:25:17.772 +01:00 [DBG] Hosting starting
2024-06-04 18:25:17.820 +01:00 [INF] Config path: C:\ProgramData\Herd\service.json.
2024-06-04 18:25:17.821 +01:00 [INF] Config file with port exists, using port: 5000.
2024-06-04 18:25:17.822 +01:00 [INF] Application started. Hosting environment: Production; Content root path: C:\Users\graememullins.config\herd\bin
2024-06-04 18:25:17.823 +01:00 [DBG] Hosting started
2024-06-04 18:25:17.831 +01:00 [INF] IPv6 is supported. Added http://[::1]:5000/ to listener prefixes.
2024-06-04 18:25:17.832 +01:00 [ERR] An error occurred while starting the HTTP server: The network location cannot be reached. For information about network troubleshooting, see Windows Help.
2024-06-04 18:25:17.832 +01:00 [ERR] An error occurred: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
2024-06-04 18:25:17.833 +01:00 [ERR] BackgroundService failed
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
at System.Net.HttpListener.Stop()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-06-04 18:25:17.838 +01:00 [FTL] The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
at System.Net.HttpListener.Stop()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-06-04 18:25:17.838 +01:00 [INF] Application is shutting down...
2024-06-04 18:25:17.839 +01:00 [DBG] Hosting stopping
2024-06-04 18:25:17.841 +01:00 [DBG] Hosting stopped
2024-06-04 18:29:39.437 +01:00 [DBG] Hosting starting
2024-06-04 18:29:39.476 +01:00 [INF] Config path: C:\ProgramData\Herd\service.json.
2024-06-04 18:29:39.477 +01:00 [INF] Config file with port exists, using port: 5000.
2024-06-04 18:29:39.477 +01:00 [INF] Application started. Hosting environment: Production; Content root path: C:\Users\graememullins.config\herd\bin
2024-06-04 18:29:39.478 +01:00 [DBG] Hosting started
2024-06-04 18:29:39.486 +01:00 [INF] IPv6 is supported. Added http://[::1]:5000/ to listener prefixes.
2024-06-04 18:29:39.488 +01:00 [ERR] An error occurred while starting the HTTP server: The network location cannot be reached. For information about network troubleshooting, see Windows Help.
2024-06-04 18:29:39.488 +01:00 [ERR] An error occurred: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
2024-06-04 18:29:39.488 +01:00 [ERR] BackgroundService failed
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
at System.Net.HttpListener.Stop()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-06-04 18:29:39.493 +01:00 [FTL] The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
at System.Net.HttpListener.Stop()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-06-04 18:29:39.493 +01:00 [INF] Application is shutting down...
2024-06-04 18:29:39.494 +01:00 [DBG] Hosting stopping
2024-06-04 18:29:39.496 +01:00 [DBG] Hosting stopped
2024-06-04 18:29:57.618 +01:00 [DBG] Hosting starting
2024-06-04 18:29:57.657 +01:00 [INF] Config path: C:\ProgramData\Herd\service.json.
2024-06-04 18:29:57.658 +01:00 [INF] Config file with port exists, using port: 5000.
2024-06-04 18:29:57.659 +01:00 [INF] Application started. Hosting environment: Production; Content root path: C:\Users\graememullins.config\herd\bin
2024-06-04 18:29:57.660 +01:00 [DBG] Hosting started
2024-06-04 18:29:57.668 +01:00 [INF] IPv6 is supported. Added http://[::1]:5000/ to listener prefixes.
2024-06-04 18:29:57.669 +01:00 [ERR] An error occurred while starting the HTTP server: The network location cannot be reached. For information about network troubleshooting, see Windows Help.
2024-06-04 18:29:57.669 +01:00 [ERR] An error occurred: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
2024-06-04 18:29:57.670 +01:00 [ERR] BackgroundService failed
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
at System.Net.HttpListener.Stop()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-06-04 18:29:57.674 +01:00 [FTL] The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
at System.Net.HttpListener.Stop()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-06-04 18:29:57.675 +01:00 [INF] Application is shutting down...
2024-06-04 18:29:57.675 +01:00 [DBG] Hosting stopping
2024-06-04 18:29:57.677 +01:00 [DBG] Hosting stopped
2024-06-04 18:30:25.598 +01:00 [DBG] Hosting starting
2024-06-04 18:30:25.637 +01:00 [INF] Config path: C:\ProgramData\Herd\service.json.
2024-06-04 18:30:25.638 +01:00 [INF] Config file with port exists, using port: 5000.
2024-06-04 18:30:25.639 +01:00 [INF] Application started. Hosting environment: Production; Content root path: C:\Users\graememullins.config\herd\bin
2024-06-04 18:30:25.640 +01:00 [DBG] Hosting started
2024-06-04 18:30:25.648 +01:00 [INF] IPv6 is supported. Added http://[::1]:5000/ to listener prefixes.
2024-06-04 18:30:25.650 +01:00 [ERR] An error occurred while starting the HTTP server: The network location cannot be reached. For information about network troubleshooting, see Windows Help.
2024-06-04 18:30:25.650 +01:00 [ERR] An error occurred: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
2024-06-04 18:30:25.650 +01:00 [ERR] BackgroundService failed
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
at System.Net.HttpListener.Stop()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-06-04 18:30:25.655 +01:00 [FTL] The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
at System.Net.HttpListener.Stop()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-06-04 18:30:25.655 +01:00 [INF] Application is shutting down...
2024-06-04 18:30:25.656 +01:00 [DBG] Hosting stopping
2024-06-04 18:30:25.658 +01:00 [DBG] Hosting stopped
2024-06-04 18:30:29.414 +01:00 [DBG] Hosting starting
2024-06-04 18:30:29.457 +01:00 [INF] Config path: C:\ProgramData\Herd\service.json.
2024-06-04 18:30:29.458 +01:00 [INF] Config file with port exists, using port: 5000.
2024-06-04 18:30:29.459 +01:00 [INF] Application started. Hosting environment: Production; Content root path: C:\Users\graememullins.config\herd\bin
2024-06-04 18:30:29.460 +01:00 [DBG] Hosting started
2024-06-04 18:30:29.468 +01:00 [INF] IPv6 is supported. Added http://[::1]:5000/ to listener prefixes.
2024-06-04 18:30:29.470 +01:00 [ERR] An error occurred while starting the HTTP server: The network location cannot be reached. For information about network troubleshooting, see Windows Help.
2024-06-04 18:30:29.470 +01:00 [ERR] An error occurred: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
2024-06-04 18:30:29.471 +01:00 [ERR] BackgroundService failed
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
at System.Net.HttpListener.Stop()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-06-04 18:30:29.476 +01:00 [FTL] The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted.
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Net.HttpListener'.
at System.Net.HttpListener.Stop()
at HerdHelper.Worker.ExecuteAsync(CancellationToken stoppingToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
2024-06-04 18:30:29.476 +01:00 [INF] Application is shutting down...
2024-06-04 18:30:29.476 +01:00 [DBG] Hosting stopping
2024-06-04 18:30:29.479 +01:00 [DBG] Hosting stopped

@sschlein
Copy link
Member

sschlein commented Jun 6, 2024

I am closing this issue here because we've moved that to the support inbox and there are other HerdHelper issues for follow up with other users.

@sschlein sschlein closed this as completed Jun 6, 2024
@graememullins
Copy link
Author

I appear to be having this issue again after a windows update;
helper_issue

@github-actions github-actions bot removed the needs more information Further information is requested label Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants