From 3b8ef0cc7125992633046ef83ad93bc67d1b22ea Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 09:36:46 -0800 Subject: [PATCH 1/2] test: require isolated service registry lookup characterization (Refs #5267) --- test/cmocka/build/test-graph.json | 21 ++++ test/cmocka/test_service_find.c | 130 ++++++++++++++++++++ test/cmocka/tests.d/test_service_find.cmake | 1 + 3 files changed, 152 insertions(+) create mode 100644 test/cmocka/test_service_find.c create mode 100644 test/cmocka/tests.d/test_service_find.cmake diff --git a/test/cmocka/build/test-graph.json b/test/cmocka/build/test-graph.json index b1e12a5040..9457d82c33 100644 --- a/test/cmocka/build/test-graph.json +++ b/test/cmocka/build/test-graph.json @@ -15305,6 +15305,21 @@ "OBS::native-test-cmocka" ] }, + "test_service_find": { + "sources": [ + "test/cmocka/test_service_find.c" + ], + "libraries": [ + "OBS::libobs", + "OBS::caption", + "Uthash::Uthash", + "OBS::native-test-cmocka", + { + "name": "OBS::w32-pthreads", + "requires": "OS_WINDOWS" + } + ] + }, "test_service_getters": { "sources": [ "test/cmocka/test_service_getters.c" @@ -27246,6 +27261,12 @@ "test_serializer": { "target": "test_serializer" }, + "test_service_find": { + "target": "test_service_find", + "command": [ + "${target}" + ] + }, "test_service_getters": { "target": "test_service_getters", "command": [ diff --git a/test/cmocka/test_service_find.c b/test/cmocka/test_service_find.c new file mode 100644 index 0000000000..22541ada45 --- /dev/null +++ b/test/cmocka/test_service_find.c @@ -0,0 +1,130 @@ +/* C-source characterization of hidden find_service (#5267). + * Real private layouts and controlled C-owned storage pin first-match order. + * A future Rust swap must relink these unchanged assertions through a real + * registry adapter; this source-only mode does not exercise a Rust swap. */ +#include +#include +#include +#include +#include +#include "obs-internal.h" + +static struct obs_core service_find_core; +struct obs_core *service_find_test_core = &service_find_core; + +#ifndef SERVICE_FIND_EXTERNAL +#define obs service_find_test_core +#include "libobs/obs-service-find.c.h" +#undef obs +#endif + +static unsigned callback_count; + +static const char *service_find_name(void *data) +{ + (void)data; + callback_count++; + return "unused"; +} + +static void *service_find_create(obs_data_t *settings, obs_service_t *service) +{ + (void)settings; + (void)service; + callback_count++; + return NULL; +} + +static void service_find_destroy(void *data) +{ + (void)data; + callback_count++; +} + +static void check_lookup(const char *id, const struct obs_service_info *expected) +{ + struct obs_service_info before[8]; + unsigned char core_before[sizeof(service_find_core)]; + assert_true(service_find_core.service_types.capacity <= 8); + size_t bytes = service_find_core.service_types.capacity * sizeof(before[0]); + if (bytes) + memcpy(before, service_find_core.service_types.array, bytes); + memcpy(core_before, &service_find_core, sizeof(core_before)); + long allocations = bnum_allocs(); + callback_count = 0; + + const struct obs_service_info *actual = find_service(id); + + assert_ptr_equal(actual, expected); + assert_int_equal(callback_count, 0); + assert_int_equal(bnum_allocs(), allocations); + assert_memory_equal(&service_find_core, core_before, sizeof(core_before)); + if (bytes) + assert_memory_equal(service_find_core.service_types.array, before, bytes); + if (expected) { + assert_ptr_equal(actual->id, expected->id); + assert_ptr_equal(actual->type_data, expected->type_data); + } +} + +static void registry_lookup(void **state) +{ + (void)state; + memset(&service_find_core, 0, sizeof(service_find_core)); + check_lookup("", NULL); + check_lookup("missing", NULL); + + char first_id[] = "svc"; + char second_id[] = "svc"; + char query[] = "svc"; + char binary_id[] = {(char)0xff, (char)0x80, 'x', 0}; + char binary_query[] = {(char)0xff, (char)0x80, 'x', 0}; + char binary_miss[] = {(char)0xff, (char)0x81, 'x', 0}; + int owners[8] = {0}; + struct obs_service_info entries[8] = {0}; + const char *ids[] = {first_id, "svc.suffix", "SVC", "", binary_id, second_id, "last", "outside"}; + for (size_t i = 0; i < 8; i++) { + entries[i].id = ids[i]; + entries[i].get_name = service_find_name; + entries[i].create = service_find_create; + entries[i].destroy = service_find_destroy; + entries[i].type_data = &owners[i]; + entries[i].free_type_data = service_find_destroy; + } + service_find_core.service_types.array = entries; + service_find_core.service_types.capacity = 8; + /* Allocated storage is not a logical entry when num is zero. */ + check_lookup(query, NULL); + service_find_core.service_types.num = 7; + check_lookup(query, &entries[0]); + check_lookup("sv", NULL); + check_lookup("svc.suffix", &entries[1]); + check_lookup("svc.suffix.more", NULL); + check_lookup("SVC", &entries[2]); + check_lookup("Svc", NULL); + check_lookup("", &entries[3]); + check_lookup(binary_query, &entries[4]); + check_lookup(binary_miss, NULL); + check_lookup("last", &entries[6]); + check_lookup("outside", NULL); + check_lookup("missing", NULL); + + /* Characterized, not endorsed: duplicate IDs select the FIRST entry. + * Moving/removing that entry must immediately affect the borrowed result. */ + struct obs_service_info swap = entries[0]; + entries[0] = entries[5]; + entries[5] = swap; + check_lookup(query, &entries[0]); + entries[0].id = "replaced"; + check_lookup(query, &entries[5]); + assert_memory_equal(first_id, "svc", sizeof(first_id)); + assert_memory_equal(second_id, "svc", sizeof(second_id)); + assert_memory_equal(owners, (int[8]){0}, sizeof(owners)); + memset(&service_find_core, 0, sizeof(service_find_core)); +} + +int main(void) +{ + const struct CMUnitTest tests[] = {cmocka_unit_test(registry_lookup)}; + return cmocka_run_group_tests(tests, NULL, NULL); +} diff --git a/test/cmocka/tests.d/test_service_find.cmake b/test/cmocka/tests.d/test_service_find.cmake new file mode 100644 index 0000000000..d85a840326 --- /dev/null +++ b/test/cmocka/tests.d/test_service_find.cmake @@ -0,0 +1 @@ +# Registered in the canonical native test graph (test/cmocka/build/test-graph.json). From 1fadad4a50e2264c5c77319b0daa80ad21cc88d5 Mon Sep 17 00:00:00 2001 From: Zach Vorhies Date: Thu, 19 Nov 2026 09:40:41 -0800 Subject: [PATCH 2/2] libobs: extract hidden service type registry lookup verbatim (Refs #5267) Ci-Attestation: {"at":1795113391,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":320,"stamp":"9f027ec39cba03efd7e44d274d26f1d5","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113391,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":320,"stamp":"cbf007518036a1710e170d0499070a69","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113391,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":320,"stamp":"e689c5051d8b2c6f163f0a8dd83261d0","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113391,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":320,"stamp":"45d66341850a0378cc1a3c9c013a47de","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113067,"gate":"general/all/client-lint","host":"linux-x86_64","key":"6a6bbe763a7019fd592c2a4e343e899a00126f2fd161880d8e35d6ac23b9d61e","lane":"client-lint","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":68,"stamp":"14eda44cc6cc11db0144651ea8f8955b","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113391,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":320,"stamp":"28cda4fa88436a2d68f05ac3e94e7c99","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113068,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"6a6bbe763a7019fd592c2a4e343e899a00126f2fd161880d8e35d6ac23b9d61e","lane":"client-lint","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":68,"stamp":"c22b42a2003ea7f76df63a80f226b316","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113068,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"6a6bbe763a7019fd592c2a4e343e899a00126f2fd161880d8e35d6ac23b9d61e","lane":"client-lint","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":68,"stamp":"a441f129c49d4cadd9248618c53ace9f","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113068,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"6a6bbe763a7019fd592c2a4e343e899a00126f2fd161880d8e35d6ac23b9d61e","lane":"client-lint","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":68,"stamp":"6487dfa2787833d36620458f3317a4d5","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113068,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"6a6bbe763a7019fd592c2a4e343e899a00126f2fd161880d8e35d6ac23b9d61e","lane":"client-lint","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":68,"stamp":"ca9c1f63432430e0aa23822e56df18b2","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113067,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"6a6bbe763a7019fd592c2a4e343e899a00126f2fd161880d8e35d6ac23b9d61e","lane":"client-lint","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":68,"stamp":"c65a0e038c3a8ecd58c4269705382397","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113067,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"6a6bbe763a7019fd592c2a4e343e899a00126f2fd161880d8e35d6ac23b9d61e","lane":"client-lint","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":68,"stamp":"c1f5cdfbcad2ce8231221b0ee8a6f013","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113068,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"6a6bbe763a7019fd592c2a4e343e899a00126f2fd161880d8e35d6ac23b9d61e","lane":"client-lint","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":68,"stamp":"a556068be74857fe8e23a4edb60a1921","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113068,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"6a6bbe763a7019fd592c2a4e343e899a00126f2fd161880d8e35d6ac23b9d61e","lane":"client-lint","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":68,"stamp":"505e331dbdd2f186cc4f34190b8051cf","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113067,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"6a6bbe763a7019fd592c2a4e343e899a00126f2fd161880d8e35d6ac23b9d61e","lane":"client-lint","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":68,"stamp":"160fe2cf0aaca069f78944c63dd03c28","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113068,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"6a6bbe763a7019fd592c2a4e343e899a00126f2fd161880d8e35d6ac23b9d61e","lane":"client-lint","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":68,"stamp":"598cbccd86ef3fa4ad66c85688716a48","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113067,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"6a6bbe763a7019fd592c2a4e343e899a00126f2fd161880d8e35d6ac23b9d61e","lane":"client-lint","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":68,"stamp":"a11fb015cc22ffb9a7ed1918ec37dc86","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795113067,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"6a6bbe763a7019fd592c2a4e343e899a00126f2fd161880d8e35d6ac23b9d61e","lane":"client-lint","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":68,"stamp":"439cde5efd7c96f6c95eefc64f8d4c2a","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Ci-Attestation: {"at":1795114639,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"e8da3f468740d1671f9a158cf731ba8c2c83e326e4127aab7ae55206565b319e","lane":"client-test-x86_64-unknown-linux-gnu","parents":["3b8ef0cc7125992633046ef83ad93bc67d1b22ea"],"secs":1246,"stamp":"e9fb706090214fe900de65b4eac7345b","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90","v":1,"via":"run"} Client-Checks: {"checks":{"base":"56689012257936de0fb59449fe30ce304bf93179","coverage":"all-tracked-applicable-files","diff":["ci/linux_qt_frontend.py","ci/test_bench_libobs_stand_ins.py","ci/test_hotkey_register_extraction.py","ci/test_linux_qt_frontend.py","libobs/build/libobs.core+.h.c","libobs/build/libobs.core-output+.h.c","libobs/build/libobs.core-source+.h.c","libobs/build/libobs.graphics+.h.c","libobs/build/libobs.ported-encoder-get-name+.h.c","libobs/build/libobs.ported-graphics-active-shader-queries+.h.c","libobs/build/libobs.ported-source-audio-pause-callbacks+.h.c","libobs/build/ported-source-sets/encoder-get-name.json","libobs/build/ported-source-sets/graphics-active-shader-queries.json","libobs/build/ported-source-sets/source-audio-pause-callbacks.json","libobs/cmake/rust-exports.d/obs-encoder-get_name.txt","libobs/cmake/rust-exports.d/obs-graphics-active_shader_queries.txt","libobs/cmake/rust-exports.d/obs-source-source_audio_pause_callbacks.txt","libobs/graphics/graphics-active-shader-queries.c.h","libobs/graphics/graphics-device-queries-fields.c.h","libobs/obs-encoder-get-name-fields.c.h","libobs/obs-hotkey-background-state.c.h","libobs/obs-hotkey.c.h","libobs/obs-output-interleave-name-fields.c.h","libobs/obs-service-find.c.h","libobs/obs-service.c.h","rust/README.md","rust/obs-build/tests/native/registration/canonical_video_info_query_is_registered.rs","rust/obs-build/tests/native/registration/headless_characterizations_expected.json","rust/obs-build/tests/native/registration/portal_output_expected.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_enum.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_press.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_background_trigger.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_binding_press_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_getters_characterization.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_load.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_pair_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_press_steps.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_hotkey_unregister_entry.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_portal_shortcuts.json","rust/obs-build/tests/native/registration/rust-static/cases/hotkey-control/test_wayland_hotkeys.json","rust/obs-c-oracle/benches/port_comparison.rs","rust/obs-c-oracle/legacy/graphics-active-shader-queries.c","rust/obs-c-oracle/oracle.d/encoder-get-name.list","rust/obs-c-oracle/oracle.d/graphics-active-shader-queries.list","rust/obs-c-oracle/oracle/device_queries.c","rust/obs-c-oracle/oracle/encoder_get_name.c","rust/obs-c-oracle/oracle/output_interleave.c","rust/obs-c-oracle/oracle/source_audio_pause_callbacks.c","rust/obs-encoder/src/ffi/get_name.rs","rust/obs-encoder/src/ffi/mod.rs","rust/obs-encoder/src/get_name.rs","rust/obs-encoder/src/lib.rs","rust/obs-encoder/tests/encoder/get_name.rs","rust/obs-encoder/tests/encoder/get_name_parity.rs","rust/obs-encoder/tests/encoder/main.rs","rust/obs-graphics/src/active_shader_queries.rs","rust/obs-graphics/src/ffi/active_shader_queries.rs","rust/obs-graphics/src/ffi/mod.rs","rust/obs-graphics/src/lib.rs","rust/obs-graphics/tests/render/active_shader_queries.rs","rust/obs-graphics/tests/render/active_shader_queries_parity.rs","rust/obs-graphics/tests/render/main.rs","rust/obs-output/src/ffi/output_interleave.rs","rust/obs-output/tests/output/interleave_parity.rs","rust/obs-source/src/audio_pause_callbacks.rs","rust/obs-source/src/ffi/mod.rs","rust/obs-source/src/ffi/source_audio_pause_callbacks.rs","rust/obs-source/src/lib.rs","rust/obs-source/tests/source/audio_pause_callbacks.rs","rust/obs-source/tests/source/audio_pause_callbacks_parity.rs","rust/obs-source/tests/source/main.rs","test/cmocka/build/test-graph.json","test/cmocka/encoder-get-name-link-support.c","test/cmocka/output-interleave-name-link-support.c","test/cmocka/test_hotkey_background_state.c","test/cmocka/test_service_find.c","test/cmocka/tests.d/test_hotkey_background_state.cmake","test/cmocka/tests.d/test_service_find.cmake","test/cmocka/tests.d/video_info_query_link_support.cmake"],"head":"923edfbb8903a73d6cf8f3e8b1518958f165e639","tools":{"orchestrator-python":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]","schema-dependencies":"3.13.15 (main, Aug 14 2026, 15:34:59) [Clang 22.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504\n compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ISO8859X Regexps Automata RelaxNG Schemas Modules Debug"},"tracked-digest":"366a08cf1473ffd9634bc42147c5b582efafa27c8dada4cd58d22099303402fd","tree":"4e62d28d9d1b107cbd474f98809a290289a2dc90"}} --- libobs/build/libobs.core-output+.h.c | 1 + libobs/obs-service-find.c.h | 11 +++++++++++ libobs/obs-service.c.h | 10 ---------- 3 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 libobs/obs-service-find.c.h diff --git a/libobs/build/libobs.core-output+.h.c b/libobs/build/libobs.core-output+.h.c index 6abc60d7eb..256b3742f0 100644 --- a/libobs/build/libobs.core-output+.h.c +++ b/libobs/build/libobs.core-output+.h.c @@ -75,6 +75,7 @@ #include "libobs/obs-output-video-encoder-getter-fields.c.h" #include "libobs/obs-output.c.h" #include "libobs/obs-service-context-getter-fields.c.h" +#include "libobs/obs-service-find.c.h" #include "libobs/obs-service-handler-getters-fields.c.h" #include "libobs/obs-service-state-adapter.c.h" #include "libobs/obs-service.c.h" diff --git a/libobs/obs-service-find.c.h b/libobs/obs-service-find.c.h new file mode 100644 index 0000000000..5f85c9b741 --- /dev/null +++ b/libobs/obs-service-find.c.h @@ -0,0 +1,11 @@ +#include "libobs/build/libobs.pch.h" + +const struct obs_service_info *find_service(const char *id) +{ + size_t i; + for (i = 0; i < obs->service_types.num; i++) + if (strcmp(obs->service_types.array[i].id, id) == 0) + return obs->service_types.array + i; + + return NULL; +} diff --git a/libobs/obs-service.c.h b/libobs/obs-service.c.h index 189b10c607..c56d154769 100644 --- a/libobs/obs-service.c.h +++ b/libobs/obs-service.c.h @@ -19,16 +19,6 @@ #define get_weak(service) ((obs_weak_service_t *)service->context.control) -const struct obs_service_info *find_service(const char *id) -{ - size_t i; - for (i = 0; i < obs->service_types.num; i++) - if (strcmp(obs->service_types.array[i].id, id) == 0) - return obs->service_types.array + i; - - return NULL; -} - /* The service's lifecycle, references, module lookup and activation moved * to obs-service-getters.c (#1920). These are the steps they take on struct * obs_service, its context and its reference counts, which stay here with