On Wed, 15 Jul 2026 at 00:03, Henrik Grubbström (Lysator) @ Pike (-) developers forum 10353@lyskom.lysator.liu.se wrote:
I'm trying to track down a truly bizarre issue, and not even sure where to start. Deep in my HTTP handler, I have this code:
mapping args = ([]); // ... various conditionals that can set args->blah = something [array streams, mapping self] = await(Concurrent.all( get_helix_paginated("https://api.twitch.tv/helix/streams", args), twitch_api_request("https://api.twitch.tv/helix/streams?user_id=" + userid), ));
Basically, by looking at different aspects of req->variables, we set different arguments to be used in the API call.
What I'm seeing, though, is that - on my secondary server, but NOT my primary - the args mapping starts out with stuff in it!
mapping args = ([]); if (req->variables->categories == "DJs") werror("RAIDFINDER ARGS %O\n", args);
I assume that the issue is intermittent?
For a while it was happening consistently, every time, but then I restarted the server and now it isn't happening.
Logically, this should always and only print out an empty mapping, yet it doesn't. The contents of the mapping look like other meaningful mappings used elsewhere in the code, so this is hard to make a minimal test case for.
Do both servers use the same exact pike binary?
They didn't, which is why I then restarted it. They were both using something close to the current master, but a handful of commits separate. I read through every commit that was different and found nothing that suggested anything, but I could probably dig up the exact hashes if it'd help.
Sounds like it's likely a reference counting bug on struct mapping_data. I have never seen this issue. It could also be due to C object files having been compiled with different configure options.
Have you run make depend?
I have not, should I? Would I need to restart the server again after doing so?
How are the mappings that you have identified created (eg mkmapping(), aggregate_mapping(), literal mappings, elements inserted one at a time, mapping addition, etc...)?
Do they have anything in common?
The spurious ones I've been seeing? Lemme check. One of them came from a constant definition:
constant LOAD_DEFINITIONS = ([ "WS": (["color": ({0x66, 0x33, 0x99}), "unit": "concurrent users", "unscaled": 1, "desc": "WebSocket users"]), ... other stuff ... ]);
and it's just the inner mapping that showed up (four elements, one an array). Another one was a global mapping that got made available via add_constant:
mapping all_twitch_scopes = ([ "analytics:read:extensions": "View analytics data for Twitch Extensions", "analytics:read:games": "View analytics data for games", ... ]);
Another one came from a constant, and again, it's an inner mapping within a larger constant:
constant command_suggestions = ([ "!addcmd": ([ "_description": "Commands - Create a simple command", "_hidden": 1, "conditional": "regexp", "expr1": "^[!]*([^ ]+) (.*)$", "expr2": "{param}", .......... ]);
with just the part keyed as "!addcmd" being what shows up.
Those are the only ones that I spotted happening, but all of them came from literals in the source code, if that helps.
Since the restart, I haven't seen the issue show up, so I don't know if it's solved, or if it was triggered by some other action, or if it'll recur at some point.
ChrisA
pike-devel@lists.lysator.liu.se