Skip to content

Conversation

@marisn
Copy link
Contributor

@marisn marisn commented Aug 15, 2022

Depending on a cache backend in use it might be necessary to perform some kind of initialization when a server worker process starts. In the case of Apache (MPM event) the child_init hook runs after a process has been created (forked) and before serving threads have been created. Currently this child_init hook is not exposed directly to cache backends and it is used only to set up connection pool. This PR adds a child_init hook for usage in any cache backend. At the moment there are no backends using this hook, although it might be required for (probably) Berkeley and (quite certainly) for TokyoCabinet backends. A LMDB cache backend requiring this hook is now under testing.

@tbonfort
Copy link
Member

OK with this patch in principle. Could you remove the changed lines where only whitespace formatting has been changed please. Also, given that very few caches actually use this, can you create a single no-op mapcache_cache_null_child_init function and reference that one instead of creating one no-op child init function per cache. thanks!

marisn added 2 commits August 25, 2022 17:25
…process.

In the case of Apache mpm_event, child_init is executed after
process start (fork) and before starting any threads that
will do actual request processing.
@marisn
Copy link
Contributor Author

marisn commented Aug 26, 2022

It is a bit pity that the astyle script present in the code base can not be run after making modifications to files.

I replaced all cache specific child init functions with a single noop function. Should be better now.

I do not understand why tests are failing as (at least locally) I see that images are generated and seem to be fine although their checksums do not match one listed in the test script. A difference in GDAL/libjpeg?

@jbo-ads
Copy link
Member

jbo-ads commented Oct 5, 2022

I think Travis CI check should be unplugged now: A GitHub Actions check has been activated few months ago. I just don't understand why it has not been triggered here.

@marisn
Copy link
Contributor Author

marisn commented Jan 18, 2023

Is there anything I can do to push this forward? #293 can not be merged before this PR.

@sdlime sdlime requested review from jbo-ads and tbonfort January 18, 2023 20:49
Copy link
Member

@tbonfort tbonfort left a comment

Choose a reason for hiding this comment

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

LGTM

@sdlime sdlime removed the request for review from jbo-ads January 19, 2023 14:24
@sdlime sdlime merged commit ac2ac10 into MapServer:main Jan 19, 2023
@marisn marisn deleted the child_init branch January 19, 2023 16:36
@jmckenna jmckenna added this to the 1.14.0 release milestone Jan 29, 2023
@landryb
Copy link
Contributor

landryb commented Jan 31, 2023

fwiw, 1.14 fails to build with clang 13 on OpenBSD:

In file included from /usr/obj/ports/mapcache-1.14.0/mapcache-1.14.0/lib/axisorder.c:30:
/usr/obj/ports/mapcache-1.14.0/mapcache-1.14.0/include/mapcache.h:389:8: error: unknown type name 'inline'
static inline void mapcache_cache_child_init_noop(mapcache_context *ctx, mapcache_cache *cache, apr_pool_t *pchild) {

dropping the inline makes clang warn about unused function 'mapcache_cache_child_init_noop' but at least the build succeeds.

@landryb
Copy link
Contributor

landryb commented Jan 31, 2023

fwiw, apparently inline fails because of forcing -std=c89

@marisn
Copy link
Contributor Author

marisn commented Feb 1, 2023

fwiw, apparently inline fails because of forcing -std=c89

This doesn't seem to be right as there is no such limitation for GCC.

@landryb
Copy link
Contributor

landryb commented Feb 1, 2023

i have no idea whether this is right or wrong, i'm just saying it fails with clang 13 in this configuration.

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.

6 participants