herd-community icon indicating copy to clipboard operation
herd-community copied to clipboard

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

Open graememullins opened this issue 1 year ago • 25 comments

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

graememullins avatar May 12 '24 18:05 graememullins

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 avatar May 13 '24 10:05 sschlein

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.

graememullins avatar May 13 '24 13:05 graememullins

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

graememullins avatar May 13 '24 19:05 graememullins

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

EG-Mohamed avatar May 14 '24 00:05 EG-Mohamed

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

graememullins avatar May 15 '24 16:05 graememullins

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

sschlein avatar May 16 '24 16:05 sschlein

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

graememullins avatar May 16 '24 16:05 graememullins

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

sschlein avatar May 16 '24 16:05 sschlein

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

graememullins avatar May 16 '24 16:05 graememullins

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 🙂

sschlein avatar May 16 '24 17:05 sschlein

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

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

graememullins avatar May 16 '24 17:05 graememullins

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.

sschlein avatar May 16 '24 17:05 sschlein

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 avatar May 16 '24 17:05 graememullins

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.

graememullins avatar May 16 '24 17:05 graememullins

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?

sschlein avatar May 17 '24 11:05 sschlein

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

graememullins avatar May 17 '24 14:05 graememullins

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

sschlein avatar May 17 '24 15:05 sschlein

Hi,

I've just send this over,

Graeme

graememullins avatar May 17 '24 15:05 graememullins

@sschlein What was the fix for this?

graememullins avatar May 20 '24 17:05 graememullins

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

sschlein avatar May 20 '24 17:05 sschlein

@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.

graememullins avatar May 20 '24 18:05 graememullins

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.

sschlein avatar May 20 '24 18:05 sschlein

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?

graememullins avatar May 20 '24 18:05 graememullins

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 avatar May 21 '24 05:05 sschlein

@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 avatar May 23 '24 07:05 sschlein

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

sschlein avatar May 23 '24 13:05 sschlein

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 avatar May 23 '24 16:05 graememullins

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>

graememullins avatar May 23 '24 16:05 graememullins

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.

sschlein avatar May 24 '24 08:05 sschlein

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/.

graememullins avatar May 24 '24 19:05 graememullins