OS thread limit reached while compiling from source #827

Closed
opened 2025-11-02 03:37:59 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @xoxys on GitHub (Jun 20, 2017).

  • Gitea version (or commit ref): 1.1.2
  • Git version: Not relevant
  • Operating system: CentOS 6
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

I use gitea on a shared hoster environment and compiling gitea from source. threads-per-user are limited to 300. Sometimes i got following error while make build for multiple modules:

runtime: failed to create new OS thread (have 7 already; errno=11)
runtime: may need to increase max user processes (ulimit -u)
fatal error: newosproc

I try to limit the threads by make with

make generate build -j2 

but the result is the same. Is it possible to limit threads/processes while compiling?

Originally created by @xoxys on GitHub (Jun 20, 2017). - Gitea version (or commit ref): 1.1.2 - Git version: Not relevant - Operating system: CentOS 6 - Database (use `[x]`): - [ ] PostgreSQL - [X] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [X] Not relevant ## Description I use gitea on a shared hoster environment and compiling gitea from source. threads-per-user are limited to 300. Sometimes i got following error while make build for multiple modules: ``` runtime: failed to create new OS thread (have 7 already; errno=11) runtime: may need to increase max user processes (ulimit -u) fatal error: newosproc ``` I try to limit the threads by make with ``` make generate build -j2 ``` but the result is the same. Is it possible to limit threads/processes while compiling?
GiteaMirror added the issue/staletopic/build labels 2025-11-02 03:37:59 -06:00
Author
Owner

@lafriks commented on GitHub (Jun 20, 2017):

use EXTRA_GOFLAGS="-j2" make generate build

@lafriks commented on GitHub (Jun 20, 2017): use `EXTRA_GOFLAGS="-j2" make generate build`
Author
Owner

@xoxys commented on GitHub (Jun 20, 2017):

I will give it a try thanks :)

@xoxys commented on GitHub (Jun 20, 2017): I will give it a try thanks :)
Author
Owner

@xoxys commented on GitHub (Jun 20, 2017):

Seems not to work. I try TAGS="bindata" EXTRA_GOFLAGS="-j1" make generate build but sometimes i get the same error:

runtime: failed to create new OS thread (have 14 already; errno=11)
runtime: may need to increase max user processes (ulimit -u)
fatal error: newosproc

Otherwise i can see the line

go build -i -v -tags 'bindata' -ldflags '-s -w -X "main.Version=1.1.2" -X "main.Tags=bindata"' -o gitea

TAGS are applied to the go build but -j1 is missing. Is it normal?

@xoxys commented on GitHub (Jun 20, 2017): Seems not to work. I try ```TAGS="bindata" EXTRA_GOFLAGS="-j1" make generate build``` but sometimes i get the same error: ``` runtime: failed to create new OS thread (have 14 already; errno=11) runtime: may need to increase max user processes (ulimit -u) fatal error: newosproc ``` Otherwise i can see the line ``` go build -i -v -tags 'bindata' -ldflags '-s -w -X "main.Version=1.1.2" -X "main.Tags=bindata"' -o gitea ``` TAGS are applied to the go build but -j1 is missing. Is it normal?
Author
Owner

@lafriks commented on GitHub (Jun 20, 2017):

just add -j1 in this line then https://github.com/go-gitea/gitea/blob/master/Makefile#L23

@lafriks commented on GitHub (Jun 20, 2017): just add `-j1` in this line then https://github.com/go-gitea/gitea/blob/master/Makefile#L23
Author
Owner

@xoxys commented on GitHub (Jun 20, 2017):

Ok Makefile included in 1.1.2 not use GOFLAGS and EXTRA_GOFLAGS. WIll this changes merged to next releases?

@xoxys commented on GitHub (Jun 20, 2017): Ok Makefile included in 1.1.2 not use GOFLAGS and EXTRA_GOFLAGS. WIll this changes merged to next releases?
Author
Owner

@lafriks commented on GitHub (Jun 20, 2017):

yes, it will be in 1.2.0 when it is released

@lafriks commented on GitHub (Jun 20, 2017): yes, it will be in 1.2.0 when it is released
Author
Owner

@xoxys commented on GitHub (Jun 20, 2017):

Sounds good, thanks for clarification.

@xoxys commented on GitHub (Jun 20, 2017): Sounds good, thanks for clarification.
Author
Owner

@xoxys commented on GitHub (Nov 8, 2017):

-j is no legal option for go build :( Luckily you can use GOMAXPROCS=2 to limit the os threads :) Maybe you want add this to the build documentation?

@xoxys commented on GitHub (Nov 8, 2017): -j is no legal option for `go build` :( Luckily you can use GOMAXPROCS=2 to limit the os threads :) Maybe you want add this to the build documentation?
Author
Owner

@stale[bot] commented on GitHub (Feb 11, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Feb 11, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#827