Repository navigation
No singletons, core: cvc::net, the volren cache, cvc-cli and core's counters per app [4.0, breaking] - #1183
Closed
transfix wants to merge 1 commit into
Closed
No singletons, core: cvc::net, the volren cache, cvc-cli and core's counters per app [4.0, breaking]#1183transfix wants to merge 1 commit into
transfix wants to merge 1 commit into
Conversation
…ounters per app libcvc keeps no process-wide state. This moves the core libraries' share of it onto cvc::app (slots) or into the objects that do the work, and deletes 53 allowlist lines (cvc 51, cvc-cli 2). cvc::net, per app: - The HTTP client (set_http_client) is the app's: send, start, http_starts_async and set_http_client take the app. http_client(app) hands out the app's client, and send(HttpClient &, req[, policy]) sends through it, for work on a thread that may outlive the app (ariadne/data.cpp's download takes it with the app and sends holding none). - The URL opener and notice, the page hooks and --no-browser (browser.cpp) are the app's: browser_available, set_browser_disabled, open_url, set_url_opener, set_url_notice, url_notice and every page:: call take the app. - Their users follow: ariadne's net_intrinsics (host_get and host_get_start take the app), net_host, oidc_host (oidc_flows(app); a session uses its app), uri_http, uri_http_cache, media, data; ari and arigl set their own app's notice. - Bug fixed: enable_oidc's --no-browser and a test's opener or fake client were process-wide, so one app's set or reset changed every other app's. volren: the resident device cache (raycast.cu's volume_cache::instance()) is the app's: raycast_cuda_cache_of(app), shared by the app's raycasters and freed with the app; raycast_cuda(cache, req); the cache controls are its methods. The content-generation counter it validates against is the app's too. cvc-cli: main makes the command's app (cvc_app()'s static is gone); each command takes it. core and the rest: - Counters: launch_pool_task's and the sliced chunks' reply channels count per app; launch_lane_task's per lane, with a random tag per lane (async_lane::next_task_key); exec_pool's call stamps per pool; the process-wide worker-pump total is gone (a pool's stats().worker_pumps remain), and the pool serial t_failed was keyed by is a per-pool life token (owner-equal weak_ptr), so a reused thread id or pool address still reads nothing stale. - CVC_EXEC_THREADS and CVC_SLICED_THREADING are read where they are used (once per pool or task), not cached in statics. dataType<T>() is decided at compile time (no typeid table). - lod's in-memory HDF5 names: each app has its own nonce and count. model's embedded-texture temp names: an app tag and count. tf::overlay_job counts each app's jobs (instances(app); a mesh job takes its app). - Constant tables are constexpr: lsys recipes, tf preset names (preset_names() returns a new vector), oidc's own parameters, spider_io's error strings, cvc::data_type_strings. - archive's fixed Huffman codes are built per decoder at its first fixed block. The EDT scratch is the call's own; se2_train's no-gradient scratch is lent from a per-call pool; media_rungs' TurboJPEG handles are a call's own, or lent from the shaper's pool. - rawiv_io's stray global header (every reader shadowed it) is gone. Left, as real process resources or another area's: curl_global_init's once flags (libcurl's global state is one per process), ImageMagick's init once, the HDF5 library lock, the CUDA device manager and raycast.cu's __constant__ tables and their upload flag, the process nice value (set_process_class), cvc-cli's serve signal flag, the stb_image statics (third-party code compiled into stb_io.cpp), and the per-thread role markers of exec_pool, thread_pool, async_lane and app::poolDropReason (each says what the calling thread is doing now) with exec_pool's group membership mutex (its home is exec_group's pool_link, in state_exec). Tests: two apps in both orders, apps on threads at once, and a later app starting clean, for the HTTP client (net_http_client_test), the browser hooks (net_oidc_test), the volren cache (volren_render_test; volren_cuda_test on CUDA), overlay job counts (tf_overlays_test), pool-task channels and data types (app_test), lod names (lod_store_test) and lane keys (async_lane_test); multi_app_integration_test's workload adds net (each app's fake client answers with its index, its opener records its own URLs, its page and --no-browser are its own), volren (each app renders its own volume; its cache holds only that) and core counters. Tests that set the process-wide client or opener now set their app's.
This was referenced Nov 12, 2026
Closed
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No singletons, core:
cvc::net, the volren cache, cvc-cli and core's counters per app. Stacked on #1176 (Ariadne part 3); a sibling of #1182. Breaking (4.0).What moved onto the app, and the bugs it fixes
cvc::net's HTTP client:send,start,http_starts_asyncandset_http_clienttake the app first.http_client(app)andsend(HttpClient&, req[, policy]). Data's download thread takes the app's client while it holds the app, and sends without the app after that.cvc::net's browser:browser_available,set_browser_disabled,open_url,set_url_opener,set_url_notice,url_noticeand everypage::function take the app first.--no-browser, were process-wide, so one app setting or clearing them changed every app. This also ends the leftover that No singletons, Ariadne part 3: URIs, HTTP, and the net and OIDC hosts per app [4.0, breaking] #1176 noted (enabling OIDC set the browser flag for the whole process).raycast_cuda_cache, one per app throughraycast_cuda_cache_of(app), andraycast_cuda(cache, req). The six free cache functions are removed.volume_cache::instance()singleton and the raycaster's generation counter are gone.mainmakes the command's app and passes it to eachcmd_*; thecvc_app()static is gone.<prefix>#<name>.<tag>-<n>.exec_pool_worker_pumps_total()is replaced by a pool'sstats().worker_pumps.dataType<T>()is decided at compile time;data_type_stringsisinline constexpr;rawivHeaderwas a stray global that every reader shadowed; it is gone.CVC_EXEC_THREADSandCVC_SLICED_THREADINGare read when a pool or task is built.overlay_jobtakes the app, andoverlay_job::instances(app).host_get/host_get_start/oidc_flows/detail::send_httptake the app.Allowlist: -53 lines (cvc 51, cvc-cli 2)
kOwn);<header>volume_cache::instance()and its guard);data_type_strings,rawivHeader, spider's strings);cvc_app()and its guard).Not removed, and why (please review)
Process resources:
curl_global_init(two once-flags);__constant__marching-cubes tables (per-device state);g_process_nice);Third-party code compiled into
stb_io.cpp: stb_image's statics. These could go inscan.py's THIRD_PARTY. Note that stb'sinvalid_chunkis a mutable static buffer, a real race between threads decoding PNGs.Per-thread role markers:
t_worker,t_caller,t_defer,t_callback,t_failed;t_active_poolandt_fanout_context;t_running_top;t_poolDropReason.Each records what the calling thread is doing right now, set and restored around a call; none holds an app's data.
exec_pool's
g_membershipmutex: its home isgroup_pool_linkin state_exec'sexec_group.h, left to the state_exec PR.Tests
net_http_client_test(two apps in both orders, threads, a later app gets the default client, a taken client outlives its replacement);net_oidc_test's browser cases (each app's opener, notice, page hooks and no-browser flag are its own);volren_render_test;volren_cuda_test(each app's own cache; skipped without CUDA);tf_overlays_test;app_test(pool-task channels per app, data types are constants);lod_store_test;async_lane_test(two lanes of one name never repeat a key).multi_app_integration_testgains three parts:net: each app's fake client answers with its index, and its opener and page are its own;volren: each app renders its own volume;core_counters.ariadne_runtime,ariadne_data,uri_http_cache,net_policy, the stub OIDC provider,cvcgl_tf_binding).Locally (Windows, MSVC Release):
net_http_client_test13,net_policy_test25,net_oidc_test13,uri_http_cache_test13;multi_app_integration_test2,app_test123,async_lane_test21,exec_pool_test33;volren_render_test53,tf_overlays_test19,tf_model_test54,lod_store_test27;ariadne_runtime_test262,ariadne_media_test56,ariadne_data_test14;cvc_cli_test160 (without the slow integration ones);cvcgl_tf_binding.raycast.cu(CUDA) was not compiled here; CI's CUDA lanes build it. pycvc and the examples were not rebuilt locally; nothing in them uses the changed API (grep).CI
Full run: the push to
ci/full/no-singletons-core, https://github.com/transfix/libcvc/actions/runs/43209799275.