-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
🐛 (macOS) Prefork is not working as expected #1208
Comments
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
Thank you for creating my issue |
@ReneWerner87 I have macOS, do you need help? Can I investigate too? |
Really appreciate it if you can help! |
I don't know if it is related, but on my AWS Linux server I get Interestingly enough, same binary will accept to run with Prefork set to true on my Linux laptop. |
Should not be related |
This means opening a separate issue, right ? |
Depends on whether you take the adapter package, then you make there an issue on The error message says in any case, that somehow the port is already occupied, you must look at your implemtation, maybe this is not possible in the aws |
|
pls check https://github.com/kavu/go_reuseport |
Is there any update on this? |
Sorry everyone, I never looked at this issue again. Are there any updates? |
@ReneWerner87 this still seems to be an issue, I'll have a look this week and see if I can fix: ~/prefork » go run main.go sixcolors@Jason-McNeils-Mac-Pro
┌───────────────────────────────────────────────────┐ ┌───────────────────────────────────────────────────┐
│ Fiber v2.52.0 │ │ Child PIDs ... 80628, 80629, 80630, 80631, 80632 │
│ http://127.0.0.1:3000 │ │ 80633, 80634, 80635, 80636, 80637, 80638, 80639 │
│ (bound on host 0.0.0.0 and port 3000) │ │ 80640, 80641, 80642, 80643, 80644, 80645, 80646 │
│ │ │ 80647, 80648, 80649, 80650, 80651 │
│ Handlers ............. 2 Processes .......... 24 │ └───────────────────────────────────────────────────┘
│ Prefork ........ Enabled PID ............. 80627 │
└───────────────────────────────────────────────────┘
ProcessId: 80628, 80627, isChild: true ProcessId: 80628, 80627, isChild: true ProcessId: 80628, 80627, isChild: true ProcessId: 80628, 80627, isChild: true ProcessId: 80628, 80627, isChild: true ProcessId: 80628, 80627, isChild: true ProcessId: 80628, 80627, isChild: true ProcessId: 80628, 80627, isChild: true ProcessId: 80628, 80627, isChild: true |
Preliminary investigation: Fasthttp prefork.go ~/prefork » go run fast.go sixcolors@Jason-McNeils-Mac-Pro
ProcessId: 81649, 81648, isChild: true ProcessId: 81649, 81648, isChild: true ProcessId: 81649, 81648, isChild: true ProcessId: 81649, 81648, isChild: true ProcessId: 81649, 81648, isChild: true ProcessId: 81649, 81648, isChild: true ProcessId: 81649, 81648, isChild: true ProcessId: 81649, 81648, isChild: true ProcessId: 81649, 81648, isChild: true ProcessId: 81649, 81648, isChild: true ProcessId: 81649, 81648, isChild: true ProcessId: 81649, 81648, isChild: true ProcessId: 81649, 81648, isChild: true This is due to the differences in how macOS and Linux handle the Fasthttp uses a file Listener when |
I am unsure about using a file listener-based approach on macOS. I thought a lightweight load balancer that uses ports greater than 1024 might be a better option. What do you think? |
Sounds good |
Fiber version
v2.5.0
OS
Systemversion: macOS 11.2.1 (20D74)
Kernel-Version: Darwin 20.3.0
Issue description
In the prefork concept, one child process is started for each cpu core and the work of the handlers is divided between these processes, so when you output the process number of the child process in the handler, different ids should appear, which is not the case here.
The goal of the ticket is to check where the problem is, because with fasthttp it works.
Code snippet
Output:
Working Fasthttp example:
Output:
The text was updated successfully, but these errors were encountered: