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

Avoid needlessly running znc-buildmod at every startup #17

Closed
wants to merge 1 commit into from

Conversation

mokou
Copy link

@mokou mokou commented Sep 6, 2018

Closes #16

/opt/znc/bin/znc-buildmod $modules || exit 12
fi
echo -n $ZNC_VERSION > .version
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else echo "not building because..."

@DarthGandalf
Copy link
Member

  1. Run ZNC
  2. Put a new module to modules/
  3. Run ZNC
  4. Wonder why the new module was not built

Rebuilding should be skipped only if there are no new modules.

@mokou
Copy link
Author

mokou commented Sep 8, 2018

Ah, is that the intention? I thought it was just to prevent ZNC from crashing at launch on an update.

@DarthGandalf
Copy link
Member

To pick up new modules automaticaly? Yes, it's intended. Otherwise, adding modules would require writing a custom Dockerfile with something like this (pseudocode)

FROM znc
COPY foo.cpp
RUN znc-buildmod foo.cpp

It's still possible to do it this way with autobuilding modules, but not required.

I thought your reason for #16 is to optimize startup time in the common case when no modules were added. And that is a good optimization... Just not as implemented in this PR.

@DarthGandalf
Copy link
Member

DarthGandalf commented Sep 8, 2018

Note that znc-buildmod doesn't prevent crash on startup after upgrade:

  1. Add foo.cpp to modules/
  2. Run ZNC, so that foo.so is built
  3. Remove foo.cpp from modules/
  4. Upgrade
  5. Run ZNC. It won't rebuild foo.so because there's no source. So it would still be module version mismatch.

Fortunately, ZNC doesn't crash on module version mismatch, because it compares version number of module and of itself, and a couple of other things before actually loading the module. See https://github.com/znc/znc/blob/2f4b158fd1d1c03eee5f73777bcb55b0d6c535b5/src/Modules.cpp#L1958-L1977
It's still possible to make it crash while loading a bad module, but not in the common case.

@mokou
Copy link
Author

mokou commented Sep 8, 2018

Right, that's the exact scenario that caused my ZNC to fail to start on the recent update from 1.7 to 1.7.1, so I'm not sure if that works for all modules. Either way I'll make the changes to this tomorrow.

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

Successfully merging this pull request may close these issues.

Only rebuild modules when ZNC version changes
2 participants