jenkinsci / maven-hpi-plugin

Maven plugin for building Jenkins plugins
http://jenkinsci.github.io/maven-hpi-plugin/
Apache License 2.0
73 stars 87 forks source link

maxFormContentSize no longer set to -1 #625

Open mawinter69 opened 5 months ago

mawinter69 commented 5 months ago

Jenkins and plugins versions report

Environment version of maven-hpi-plugin 3.55

What Operating System are you using (both controller, and any agents involved in the problem)?

windows

Reproduction steps

  1. checkout role-strategy plugin sources and run with mvn hpi:run
  2. enable rolestrategy and configure an admin user
  3. create 100 item roles and assign 100 users via rest api (see shell script below)
  4. open the assign roles page (http://localhost:8080/jenkins/manage/role-strategy/assign-roles)
  5. save/apply the page
for i in $(seq 1 100);
do
  curl -X POST -i -u user:token http://localhost:8080/jenkins/role-strategy/strategy/addRole --data "type=projectRoles&roleName=role-$i&permissionIds=hudson.model.Item.Read&overwrite=true&pattern=test-$i"
  curl -X POST -i -u user:token http://localhost:8080/jenkins/role-strategy/strategy/assignUserRole --data "type=projectRoles&roleName=role-$i&user=user-$i"
done

Expected Results

the page is saved

Actual Results

saving fails with error

Anything else?

In the logs we can see

2024-06-12 22:33:39.593+0000 [id=1224]  WARNING h.i.i.InstallUncaughtExceptionHandler#handleException: Caught unhandled exception with ID 01967e9d-2692-423c-9d3a-eb003afbc9db
java.lang.IllegalStateException: Form is larger than max length 200000
        at org.eclipse.jetty.server.Request.extractFormParameters(Request.java:593)
        at org.eclipse.jetty.server.Request.extractContentParameters(Request.java:546)
        at org.eclipse.jetty.server.Request.getParameters(Request.java:466)

In winstone change https://github.com/jenkinsci/winstone/pull/95 the configuration was changed from setting a system property to calling the method setMaxFormContentSize from the jetty Context.

This change needs to be repeated here

Are you interested in contributing a fix?

No response