Repository navigation
fix(bbb-web): keep controller helpers out of the URL space, drop the dead 500 view, trust createNewFile() (#26002, 2/3) - #26202
Conversation
Grails makes every public method and every closure property of a controller an action, and the generic /bigbluebutton/$controller/$action mapping makes each action reachable over HTTP without a checksum. Four helpers had ended up there. ApiController.handleCreateUserClientUrl builds the client URL for join. GET /bigbluebutton/api/handleCreateUserClientUrl answered 200 with an empty body, and the Grails 8 build warns that the action takes a UserSession parameter, which is not Validateable. It becomes private, like the other join helpers. The initResponseBuilder closures of ApiController and RecordingController set up the controller's FreeMarker ResponseBuilder. GET /bigbluebutton/api/initResponseBuilder and /bigbluebutton/recording/initResponseBuilder answered 200 and replaced the singleton controller's ResponseBuilder on every request. They become private methods that return the builder for the field initialiser to store, as it did before. ApiController.beforeInterceptor is a Grails 2 controller interceptor. Grails 3 dropped controller interceptors in favour of standalone ones, so it has not run before any action since bbb-web moved to Grails 3 in 2019; requested by name, it answered 500 because there is no view to render. It is deleted. All four URLs now answer 404 like any other unknown action. Part of bigbluebutton#26002.
serviceEnabled is documented as "Whether the BigBlueButton API is enabled". Its only reader was ApiController's Grails 2 beforeInterceptor, which has not run since the move to Grails 3 and was removed in the previous commit, so serviceEnabled=false has not disabled anything for years. The property, its bean wiring, the ParamsProcessorUtil field with its accessors, and the row in the bbb-web settings table all go. A serviceEnabled line left in /etc/bigbluebutton/bbb-web.properties is ignored, as it effectively already was. Part of bigbluebutton#26002.
…tus markers RecordingServiceFileImpl writes the .done markers that start the recording pipeline (status/recorded/<id>.done, the chapter-break <id>-<timestamp>.done, and status/ended/<id>.done) with createNewFile() and then checked exists() to see whether that worked. rap-starter watches those directories with inotify and deletes a marker as soon as it has queued the archive job, so the second check can lose the race: bbb-web logged "Failed to create .../<id>.done file." at ERROR level although the file had been created and the recording was archived normally. It showed up for about one recorded meeting in fourteen in Playwright runs on a 4.0 server, with rap-starter's "Enqueuing job to archive" logged a millisecond before the error. createNewFile() already reports the outcome atomically: true when it created the file, false when the file existed, an IOException when it failed. The three methods now share one helper that relies on it; the "already exists" error stays, and the IOException is logged with its stack trace instead of being dropped. Part of bigbluebutton#26002.
Nothing tested the .done markers RecordingServiceFileImpl writes for rap-starter. The new spec checks the three paths (recorded/<id>.done, recorded/<id>-<timestamp>.done for a chapter break, and ended/<id>.done next to the recorded directory), that a marker which already exists is left in place, and that a marker which cannot be created does not throw. The race with rap-starter deleting a marker cannot be reproduced deterministically without injecting the file, so the spec pins the behaviour around it rather than the race itself. Part of bigbluebutton#26002.
… view mapping PresentationController.index rendered the upload-file view, and UrlMappings sent every HTTP 500 to the /error view. bbb-web ships no views: the GSP pages were deleted in 2022 (69c7677). So GET /bigbluebutton/presentation failed in the view resolver, and the error dispatch of every HTTP 500 failed there a second time, which left Tomcat's default HTML page as the response. The index action and the 500 mapping go. A 500 is now answered by Spring Boot's error handling, as bbb-web's 404s already are: a JSON body, or the Whitelabel page for a browser that asks for HTML. /bigbluebutton/presentation now fails the way /bigbluebutton/recording and /bigbluebutton/connection already do: the generic $controller/$action mapping defaults to an index action the controller does not have, and Grails answers 500 with "Invalid action name: index". A failing request still logs one "Could not resolve view with name '/error'" ERROR, down from two: GrailsExceptionResolver maps every exception to an /error view of its own, independently of UrlMappings. Part of bigbluebutton#26002.
handleCreateUserClientUrl, the two initResponseBuilder methods and the old beforeInterceptor answered 200 or 500 through the generic /bigbluebutton/$controller/$action mapping. The test requests each of them and expects 404, after checking that the generic mapping still serves a real action (api/index), so a 404 cannot come from the mapping itself being gone. It fails against bbb-web from v4.0.x-develop before the fix. Part of bigbluebutton#26002.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe API service-enabled field, accessors, configuration, and documentation entry were removed, along with the API controller’s service-enabled interceptor. Controller response-builder initialization now returns builders for supported resource protocols and Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix Possibly related issues
Suggested reviewers: Merge Risk: ⚪ Minimal · up to
|
serviceEnabled is gone from bbb-web. It was documented as switching the API off, but its only reader was ApiController's Grails 2 beforeInterceptor, which has not run since bbb-web moved to Grails 3 in BBB 2.2, so serviceEnabled=false has not disabled the API on any supported release. An operator who set it may believe the API is off. bbb-conf --check now lists it among the retired properties, so its removal does not go unnoticed. Part of bigbluebutton#26002.
new-features.md lists serviceEnabled among the removed bbb-web properties: what it was documented to do, why it has had no effect since BBB 2.2, that bbb-conf --check flags a leftover value, and that a resources.xml customized in place must drop its serviceEnabled property or bbb-web will not start. Part of bigbluebutton#26002.
🚨 Automated tests failed |
8ca86b3
into
bigbluebutton:v4.0.x-develop
…xist GET /bigbluebutton/presentation, /bigbluebutton/recording and /bigbluebutton/connection answered 500. The generic "/bigbluebutton/$controller/$action?" mapping matches a controller name alone, and Grails registers a route without an action for every controller, so the request reaches DefaultGrailsControllerClass.invoke with no action. invoke falls back to the default action, index, which none of these controllers has, and throws "IllegalArgumentException: Invalid action name: index", which GrailsExceptionResolver turns into a 500. PresentationController had an index action until #26202, but it rendered a view that never existed, so that URL answered 500 before too. A URL naming an action the controller lacks, such as /bigbluebutton/presentation/noSuchAction, already answered 404: Grails skips a wildcard match whose action is not registered. UnknownActionInterceptor runs for every request. When the request names an existing controller and an action that controller does not have (with no action in the URL, its default action), it answers 404 and stops the request. It renders the body itself, in the shape Spring Boot's error page gives an unknown path: a response committed from an interceptor never reaches that page, so sendError() would leave the body empty. Requests for real actions, names that are not controllers and requests without a controller pass through unchanged; /bigbluebutton/api still runs ApiController.index. UnknownActionInterceptorSpec covers the three bare controller URLs, an unknown action and real actions of the four controllers. The test floor MIN_EXPECTED_TESTS goes from 40 to 80; 87 tests run with this commit. The controllerWithoutActionNotFound Playwright test checks the status and the JSON body against a server.
…ssing view Every unhandled exception in bbb-web wrote two ERROR stack traces. The first is GrailsExceptionResolver logging the exception. The resolver is configured to map java.lang.Exception to the view /error, and only a "500" URL mapping to a controller replaces that view. The "500"(view: '/error') mapping removed in #26202 named the same view, and grails-app/views has never held one, so DispatcherServlet.render threw "ServletException: Could not resolve view with name '/error'". Tomcat logged that as the second trace and Spring Boot's error page wrote the response: {"timestamp":..,"status":500,"error":"Internal Server Error", "path":".."}. On a 4.0.1 test server the second trace appeared 50 times in one day. Map "500" to ErrorController.serverError. The resolver now forwards the request there instead of returning a view, and the action writes the same JSON body clients already receive, with the path of the request that failed (jakarta.servlet.forward.request_uri on that forward, jakarta.servlet.error.request_uri when Tomcat dispatches a 500 itself). It logs nothing, since the resolver already has. The generic $controller/$action mapping makes /bigbluebutton/error reachable as well; a request that is not an error dispatch gets 404 there. Spring MVC's own exception resolvers run before the Grails one, so the 404 and 405 responses for unknown paths and methods do not change. ErrorControllerSpec covers the forward from the resolver, a 500 error dispatch from Tomcat and a direct request. UrlMappingsSpec checks that 500 maps to error/serverError. 91 tests run with this commit. The Playwright test controllerWithoutActionNotFound now also expects 404 for /bigbluebutton/error.
What does this PR do?
Fixes the #26002 items whose effect is visible from outside bbb-web: controller helpers that answered as HTTP actions, a false ERROR when a recording is handed to the pipeline, and a dead view mapping that broke the response of every HTTP 500. It also removes the
serviceEnabledsetting, which has done nothing since Grails 3. This is the second of three PRs for #26002.Closes Issue(s)
Part of #26002:
handleCreateUserClientUrl,RecordingServiceFileImpl, and the views and 500 mapping part of "unused views and message bundle". The message bundle itself is removed in the first PR.Changes
bigbluebutton-web
/bigbluebutton/$controller/$actionmapping makes each one reachable without a checksum. Four helpers were in that namespace:ApiController.handleCreateUserClientUrl(String, UserSession)answered 200 with an empty body. It is nowprivate, like the otherjoinhelpers. This also removes the Grails 8 build warning about a non-ValidateableUserSessionaction parameter.initResponseBuilderclosures inApiControllerandRecordingControlleranswered 200 and replaced the singleton controller'sResponseBuilderon every request. They are now private methods that return the builder for the field initialiser. These two were not in the issue.ApiController.beforeInterceptor, a Grails 2 controller interceptor, has not run before any action since Grails 3 dropped controller interceptors. Requested by name, it answered 500. It is deleted; it was not in the issue either.serviceEnabled("Whether the BigBlueButton API is enabled") was read only by thatbeforeInterceptor, soserviceEnabled=falsehas not disabled anything since 2019. The property, its bean wiring, theParamsProcessorUtilfield and accessors, and the row incustomize.mdare removed. This is a separate commit, so it can be dropped on its own if the setting should be revived instead.bbb-conf --checklistsserviceEnabledamong the retired bbb-web properties, andnew-features.mdannounces it under "bbb-web properties changes / Removed", including the note for aresources.xmlcustomized in place.PresentationController.indexrendered the viewupload-file, andUrlMappingsmapped500to the view/error. bbb-web ships no views (the GSPs were deleted in 69c7677). SoGET /bigbluebutton/presentationfailed in the view resolver, and the error dispatch of every 500 failed there a second time, which left Tomcat's default HTML page as the response. The action and the mapping are removed.bbb-common-web
RecordingServiceFileImplwrites the.donemarkers that rap-starter watches. It calledcreateNewFile()and then checkedexists(). rap-starter deletes a marker as soon as it has queued the archive job, so that check could lose the race and log "Failed to create .../.done file." although the file had been created and the recording was archived normally (seen in two of three Playwright runs of 14 recorded meetings each while bbb-web: cleanups found during the Grails 8 upgrade (#25466) #26002 was being written; it did not surface in the runs below). The three methods now share one helper that relies oncreateNewFile()'s return value. The "already exists" error stays, and anIOExceptionis now logged with its stack trace instead of being dropped.Tests
RecordingServiceFileImplTest: the recorded, chapter-break and ended marker paths; an existing marker left in place; a marker that cannot be created does not throw.controllerHelpersNotReachable(@ci): each of the four helper URLs answers 404. It first checks that the generic mapping still serves a real action (api/index), so the 404 cannot come from the mapping being gone.Behaviour
Measured with curl on the test server described below:
GET /bigbluebutton/api/handleCreateUserClientUrlGET /bigbluebutton/api/initResponseBuilderand/bigbluebutton/recording/initResponseBuilderGET /bigbluebutton/api/beforeInterceptorGET /bigbluebutton/presentation/indexGET /bigbluebutton/presentationcreatewithoutsequenceAccept: text/htmlbbb-web.loggrep -ccounts: the probe run's five failing requests added 20 matching lines before, its four failing requests added 8 after./bigbluebutton/presentationnow fails the way/bigbluebutton/recordingand/bigbluebutton/connectionalready do: the generic mapping defaults to anindexaction the controller does not have, and Grails answers 500 with "Invalid action name: index".GrailsExceptionResolver, which maps every exception to an/errorview of its own, independently ofUrlMappings.serviceEnabled=falsein/etc/bigbluebutton/bbb-web.propertiessees no change: the API was not disabled before and is not now.bbb-conf --checklists the line for removal. WithserviceEnabled=falseset on the stock bbb-web of the test server,create,join,isMeetingRunning,getMeetingsandendall returned SUCCESS; only a direct request to/bigbluebutton/api/beforeInterceptorproducedapiNotEnabled.resources.xmlcustomized in place that still setsserviceEnabledkeeps bbb-web from starting;new-features.mdsays so.Verification
On a 4.0 development server installed from the
v4.0.x-developpackages (every BigBlueButton package at 4.0.1). Its stock bbb-web was built from dda8d28, the last commit onv4.0.x-developthat touchedbigbluebutton-weborbbb-common-web, so it is bbb-web at this PR's base in everything but the version string. "Before" is that package. "After" isv4.0.x-develop(09c1e34) with this PR and the other two #26002 PRs merged, built withbuild/setup.sh bbb-webinbbb-build:v4.0.x-release--2026-10-21-124037and installed over the package; the stock package was put back afterwards. The same checks, without the recording suite, had been run earlier on a 4.1 development server running a merge ofv4.0.x-developintov4.1.x-develop(Grails 8.0.0), with the same results.RecordingServiceFileImplTest+XmlServiceImplTest(sbttestOnly)assembleand Spock tests (./gradlew test)ApiControllerSpecis@Ignored)build/setup.sh bbb-webpackage build on the 4.0 server: thehandleCreateUserClientUrl/Validateablewarningv4.0.x-developbuild, gone with the three PRsbbb-web.logbbb-confretired-property loop against a samplebbb-web.propertiesthat setsserviceEnabledcontrollerHelpersNotReachableapi/handleCreateUserClientUrlanswered 200), PASS afterapi,presentation,learningdashboard,recording(@ci, 93 tests)controllerHelpersNotReachableand "Hide Presentation Toolbar"), after 92 passed / 1 failed. "Hide Presentation Toolbar" is the same screenshot mismatch in both runs and does not involve bbb-webrecordingsuite within those (17 tests: recorded meetings, processing, playback)bbb-web.logduring each Playwright runbbb-common-web's test tree does not compile as a whole on
v4.0.x-develop:UnitSpecand the six specs built on it use pre-3.2 ScalaTest names. So the new spec ran with those files set aside, usingset Test / testOptions := Nil. CI runs neithersbt testnorgradlew test.The race with rap-starter did not surface in the baseline run on this server, so the recording suite shows that the markers still start the pipeline and the recordings process and play back, not the ERROR going away. The race cannot be reproduced on demand; the fix removes the second check rather than racing it.
Left alone, possible follow-ups
/bigbluebutton/presentation,/bigbluebutton/recording,/bigbluebutton/connection) answer 500 "Invalid action name: index"; a 404 would be more accurate.GrailsExceptionResolverstill looks for an/errorview and logs "Could not resolve view with name '/error'" once per failing request.createwithisBreakout=trueand nosequencestill answers 500 (NumberFormatException). That is tracked by the@known-issuetestbreakoutWithoutSequenceNumber.POST /bigbluebutton/api/join) falls through toindexand answers 200 with the version document; 405 would be more accurate.UnitSpecon ScalaTest 3.2 names) so thatsbt testruns as a whole.More
Related: #25466, #26002, 69c7677.