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

the service cannot be started when using in k8s pod and response "find: The environment is too large for exec()." #296

Open
ericyau82 opened this issue Jul 26, 2023 · 4 comments

Comments

@ericyau82
Copy link

used image:

redmine:5.0.5-alpine3.18

the service response

find: The environment is too large for exec().

when starting the service


finally, i fixed the issue by updating the official function _fix_permissions() used in

/docker-entrypoint.sh

updated function:

_fix_permissions() {
	# https://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-8-File-system-permissions
	# local dirs=( config log public/plugin_assets tmp ) args=()
	# if [ "$(id -u)" = '0' ]; then
	# 	args+=( ${args[@]:+,} '(' '!' -user redmine -exec chown redmine:redmine '{}' + ')' )

	# 	# https://github.com/docker-library/redmine/issues/268 - scanning "files" might be *really* expensive, so we should skip it if it seems like it's "already correct"
	# 	local filesOwnerMode
	# 	filesOwnerMode="$(stat -c '%U:%a' files)"
	# 	if [ "$files" != 'redmine:755' ]; then
	# 		dirs+=( files )
	# 	fi
	# fi
	# # directories 755, files 644:
	# args+=( ${args[@]:+,} '(' -type d '!' -perm 755 -exec sh -c 'chmod 755 "$@" 2>/dev/null || :' -- '{}' + ')' )
	# args+=( ${args[@]:+,} '(' -type f '!' -perm 644 -exec sh -c 'chmod 644 "$@" 2>/dev/null || :' -- '{}' + ')' )
	# find "${dirs[@]}" "${args[@]}"
	mkdir -p tmp tmp/pdf public/plugin_assets
	chown -R redmine:redmine files log tmp public/plugin_assets
	chmod -R 755 files log tmp public/plugin_assets
}

may i know if there is any other solution? will it be fixed on the coming update?
thanks a lot

@tianon
Copy link
Member

tianon commented Jul 26, 2023

That sounds like you might have too many (or too big) environment variables, somehow? 😬 Does your pod have a lot set?

If that's it, you could fix it in this specific instance by prefixing find with something like env -i (find env -i ...), but if my assumption about environment variables is correct this might just be the tip of the iceberg. 🙈

@ericyau82
Copy link
Author

yup, many environment variables is set by our deployment script before (around 40 up are set) 00|

@tianon
Copy link
Member

tianon commented Dec 14, 2023

Are all the variables you're setting on the container actually relevant to Redmine? Does it read them all? Could some of them be files instead? (This seems like a pretty big edge case that's going to be hard for us to justify supporting 🙈)

@ericyau82
Copy link
Author

thx for your reply

not really, actually those variable are set by the deployer(our team use gitlab to trigger a common deployer for deploying the project. And, i can just report to the corresponding team for follow up and cannot update the script directly. While thecorresponding team view it as a edge case too as no other projects reported similar issue and much projects need to be re test for the deployment if the deployer is updated🙈🙈)

actually, the solution is still work for recent update (redmine:5.1.1-alpine3.18), i will keep using it temporarily.

thanks for your follow up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants