Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
routing system
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
19 Feb 2014 at 09:32 UTC
Updated:
29 Jul 2014 at 23:23 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
btmash commentedAttached patch.
Comment #2
btmash commentedComment #4
btmash commentedThe unit tests are a new thing to me and I totally didn't understand what the fails were on. Finally getting the gist of it and hopefully new patch resolves the test failures.
Comment #5
btmash commentedAlso...needs review.
Comment #6
damiankloip commentedWe should summon Crell here too I think.
I am wondering, if we go down this path or flushing before rebuilds we will have to decide what to do with code in MatcherDumper::dump() as alot of that may not be applicable anymore if we work under the assumption that all routes will be cleared out.
Comment #7
btmash commentedWhen I looked at the code in
MatcherDumper::dump(), I thought it was really interesting since something else **could** clear out certain routes if it wanted (without necessarily clearing out all routes). I thought it was useful to have in there but I don't know too much about that set of code to really make a case for/against it.Comment #8
dawehnerJust a general note: the old menu system ensured that the table was cleared before. This is a safe assumption, sure, thought I wonder whether we should have some bigger transaction, to be sure that we never loose our sort of working routing.
@BTMash
For this usecase I really think we need some integration kind of webtest, as we want to test the full system, not just each component.
Comment #9
catchWould be better to dump just before writing the routes as opposed to before collecting them - much shorter window where there's an empty table.
Do we already trigger a rebuild when there's no routes? Or is there already a lock/wait cycle? If not that should be added here.
Comment #10
damiankloip commentedWas talking to catch about this, whilst doing so I had another idea. We could clear out any router items on module uninstall instead. That way we do not mess with any exiting functionality or have to worry about multiple rebuilds/locks/empty router tables.
Super small patch.
Comment #12
dawehnerIt is sad that we couple the module handle to even more bits. Can we at least inject the service?
Comment #13
btmash commentedI'm not wholly agreeing with the change as I do think that rebuilding the router should mean flushing it out fully and rebuilding it (module uninstall is one scenario; I'm guessing of a scenario where routes in a module change after an update and cache rebuild possibly doesn't remove the old ones or if something implements the idea of disabling routes. That is why I'll attach my patch from above with tests in another comment. But I also lack the level of knowledge everyone else has on this components in the issue which is where I can agree with the fix.
Comment #14
berdir@BTMash: The dumper already flushes and re-inserts... per provider/module. The only problem should be when modules no longer exist, then they wouldn't be flushed.
Comment #15
damiankloip commented@dawehner, that would then the the only service injected. Seems better to just follow suit in this case? Then maybe fix all of this when I have done this work on the module event?
@berdir, exactly, Our current code in the MatcherDumper already handles all other cases. This is the approach that is the least invasive also. Preserving the current functionality completely.
Comment #16
damiankloip commentedAlso, just created #2206347: Use event system in ModuleHandler to hopefully untangle the rats nest that is the module handler.
Comment #17
dawehnerThe fix seems to be the way to go on the midterm
Comment #18
btmash commentedSpoke with @damiankloip, @berdir on this in irc to clear up my concerns. All cases should be accounted for. Finally, patch works (and looks good). RTBC as far as I'm concerned.
Comment #19
berdirAgreed. Also updating the issue title to better reflect what we're doing. Slightly updated the proposal to reflect what we're doing in now.
Comment #20
catchYep, this looks great now. Committed/pushed to 8.x, thanks!