Merge lp://qastaging/~alan-griffiths/compiz-core/rework-updatePlugins into lp://qastaging/compiz-core

Proposed by Alan Griffiths
Status: Superseded
Proposed branch: lp://qastaging/~alan-griffiths/compiz-core/rework-updatePlugins
Merge into: lp://qastaging/compiz-core
Diff against target: 686 lines (+439/-107) (has conflicts)
4 files modified
include/core/plugin.h (+1/-1)
src/privatescreen.h (+6/-0)
src/privatescreen/tests/test-privatescreen.cpp (+352/-13)
src/screen.cpp (+80/-93)
Text conflict in src/privatescreen/tests/test-privatescreen.cpp
To merge this branch: bzr merge lp://qastaging/~alan-griffiths/compiz-core/rework-updatePlugins
Reviewer Review Type Date Requested Status
Daniel van Vugt Disapprove
Review via email: mp+99797@code.qastaging.launchpad.net

This proposal has been superseded by a proposal from 2012-03-29.

Description of the change

Try to avoid finalize/re-init based on...

/1/ I think in the general case we need to be able to finalize and
re-initialize plugins. Plugins that can't cope are broken, I don't
think there's a way around that.

Scenario: plugin B depends on plugin A - whenever plugin A is unloaded
and reloaded plugin B must be finalized and reinitialized. (Example A:
composite, B:opengl - opengl has pointers to composite which would go
stale when composite is finalized.)

/2/ I don't grok the opengl plugin well enough to fix it quickly.

/3/ updatePlugins does more finalize/re-initialize than is strictly
necessary - because the logic is pants.

/3.1/ One test case we have is:

plugin: A, B, C - where B fails to load, but A and C succeed. (NB:
there is a fine distinction here between a plugin failing to /load/ and
failing to /init/.)

Then, whenever updatePlugins runs for second or subsequent occasions,
it detects that currently loaded "AC" isn't desired "ABC" and finalizes
C before trying to reload B (which fails) before re-initializing C.

BUT there is no possible reason to do the finalization of C until it is
about to init B - which never happens because B fails to load.

FURTHER any plugin C that has successfully initialized can't (well, it
shouldn't!) have dependences on any plugin B that is not loaded or
initialized.

/3.2/ AFAICS we ONLY need to finalize plugins when we are unloading
plugins. And we need to do this from the end of the list to the plugin
in question. That is: if we have "ABC" loaded, then to unload B, we
first need to finalize C and then B. (C.f. /1/ above.)

/4/ Part of the problem therefore is that the CompPlugin class conflates
management of the plugin stack with initialization and finalization of
the plugins. (E.g. Just because some plugins are "popped" to insert a
new one, doesn't require them to be finalized. (C.f. 3.2 above))

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Re: "Just because some plugins are "popped" to insert a new one, doesn't require them to be finalized."
This is untrue. Some plugins have loose dependencies on others and change their behaviour/features depending on what other plugins are loaded. Hence popped plugins must be fini'd and reinitialized.

Also, even if this branch works perfectly I would still be unhappy with the risk associated with such a large change in critical logic. Please don't hate me...

I'm looking at a much smaller/simpler solution. In fact I was designing it in my head as you designed this code. Will let you know if/when I think I have something that works.

In other news, the two critical bugs we're aiming to fix have had ZERO duplicates in the past two days. It sounds like the workarounds are working.

review: Abstain
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I've tested it now. The big startup bugs are avoided, however it causes a regression: Disabling plugins in ccsm has no effect. Those plugins remain active and running even after they are removed from the active_plugins list. That's one reason why I proposed the new logging last night. It's useful :)

Arguably, it's an acceptable compromise to fix the critical issues and introduce a less severe bug. However the the size of the new code in updatePlugins still makes me a little scared. Also, I managed an equally successful hack yesterday with just a few lines changed, but similar regressions.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Replaced by: https://code.launchpad.net/~vanvugt/compiz-core/fix-startup-plugins/+merge/99886
Which has no such regressions. And is smaller, simpler.

review: Disapprove
3072. By Alan Griffiths

Some additional testing of updatePlugins inspired by #963264

3073. By Alan Griffiths

Revert change that core dumps test

3074. By Alan Griffiths

Some additional testing of updatePlugins inspired by #963264

3075. By Alan Griffiths

Avoid graphics corruption and hangs on compiz start-up by ensuring that
plugins don't get initialized, de-initialized and re-initialzed during
start-up. (LP: #963093) (LP: #963633)

The multiple init/fini/init calls occured when compiz was asked to load an
invalid plugin name. This occurred most recently as plugins "bailer" and
"detection" were left in some peoples' configs while the plugins themselves
no longer exist in the current compiz release.

The source of the graphics corruption and hangs has been found to be a
problem in the composite and/or opengl plugins. One or both of them are unsafe
to init/fini multiple times without a full compiz restart. So the root cause
is not exactly known yet. However composite and opengl are not alone; many
plugins have bugs with init/fini/init sequences, so it is valuable to fix
the start-up plugin ordering as this does.

Essentially this fix works by remembering which plugins don't exist at all
and putting them on a black list. Then subsequent updates check the blacklist
and know they should never include those failed plugins in testing whether
the active plugin lists have changed.

The final part of the fix is to remove a rendundant call to updatePlugins from
EventManager::init. It is not required as main tells PluginManager when to
load plugins on startup.

IMPORTANT NOTE FOR UBUNTU PACKAGING
In downstream ubuntu branches the DEFAULT_PLUGINS list in "debian/rules" also
causes multiple plugin loads on start-up and prevents this fix from working!
The solution is to change DEFAULT_PLUGINS to just "ccp".

3076. By Sam Spilsbury

Use the stack order when determining the next window to focus instead
of the focus order when click focus is enabled. (LP: #888704)

3077. By Daniel van Vugt

Revert locally integrated menus support because it is not being used and
is apparently causing a regression (LP: #962085)

This reverts LP: #931245 and LP: #682788. It is a pure revert of
lp:compiz-core r3036.

3078. By Daniel van Vugt

Update NEWS and bump VERSION to 0.9.7.4 ready for release candidate.

3079. By Daniel van Vugt

Add missing NEWS item: Fix for #964248

3080. By Alan Griffiths

Fix memory leak

3081. By Alan Griffiths

Memory leak in dlloaderListPlugins

3082. By Alan Griffiths

Memory leak in dlloaderListPlugins

3083. By Alan Griffiths

Memory leak in dlloaderListPlugins

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches