ID:2129715

 BYOND Version: 510 Operating System: Linux Web Browser: Chrome 52.0.2743.85 Applies to: Dream Daemon
 Status: Open Issue hasn't been assigned a status value.
Descriptive Problem Summary:
Recently, our automated testing setup has been returning errors that don't make sense, saying that a string is not in a list, despite the fact it plainly is.

Numbered Steps to Reproduce Problem:
Unknown. Travis builds seem to reproduce it with reasonable probability, I've so far been unable to narrow it down to a simple test case, and unable even to reproduce it outside of the CI environment.

Code Snippet (if applicable) to Reproduce Problem:

Expected Results:
Any icon states in excepted_icon_states (ie those printed before the test proper runs) would be skipped

Actual Results:

## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: Excepted icon states:
## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: b1 - 2
[...]
## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: spiderbot-chassis-mmi - 21
## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: spiderbot-smashed - 17
## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: droid-combat-roll - 17
[...]
## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: robot+we - 8
## UNIT_TEST ##: Eye icon state eyes-spiderbot-smashed - 17 is missing.

Does the problem occur:
Every time? Or how often? Not every time, but with reasonable probability
In other games? Unknown
In other user accounts? Unknown
On other computers? Not as observed

When does the problem NOT occur? Unknown

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Unknown

Workarounds: ???

 Aug 10 2016, 8:50 am I don't see anything in your code that guarantees eyes-spiderbot-smashed is in fact in valid_states. Why don't you print out the full contents of valid_states when a missing state is detected?
 Aug 10 2016, 10:15 am I'm having this issue. I'll try to whip up a demo.
 Aug 10 2016, 2:00 pm In response to Lummox JR Lummox JR wrote: I don't see anything in your code that guarantees eyes-spiderbot-smashed is in fact in valid_states. Why don't you print out the full contents of valid_states when a missing state is detected? The issue isn't that eyes-spiderbot-smashed isn't in valid_states, though it's true that it's not; the issue is that execution should never reach the point that the presence of eyes-spiderbot-smashed gets checked: var/list/original_valid_states = valid_states.Copy()for(var/icon_state in valid_states) if(icon_state in excepted_icon_states_) // This should be true, "spiderbot-smashed" is in excepted_icon_states_! continue if(starts_with(icon_state, "eyes-")) continue if(findtext(icon_state, "openpanel")) continue var/eye_icon_state = "eyes-[icon_state]" if(!(eye_icon_state in valid_states)) log_unit_test("Eye icon state [eye_icon_state] - [length(icon_state)] is missing.") missing_states++ 
 Aug 10 2016, 5:51 pm Wouldn't be shocked if this was linux only, or maybe on travisCI with its smaller memory pool, and higher likelihood of memory having a non-zero value, and higher likelihood of memory assignments being closer together it's triggering a memory usage error like uninitialized read and/or use after free. Anywho, how constant is the occurrence? is it always on the same part of the list? always on the same list? always on the same string?
 Aug 11 2016, 1:39 pm yea nvm this is happening to me too and i was doing something simple checking if a text string was in a list
 Aug 11 2016, 1:57 pm I would recommend printing out the relevant icon_state and all relevant lists, in cases when it slips through the logic. It'd help to know what's being compared to what. (For the output, I would also recommend using the \ref macro if an item in the list is not a string, a number, or null.)
 Aug 11 2016, 3:03 pm Interesting. I ran it again printing string refs; given that strings are deduplicated and put in a tree, identical strings should have the same refs AFAIAA. Code: https://github.com/GinjaNinja32/Baystation12/blob/ c32ca09b14cab73c4f9b460d7cd04d767e0f28df/code/unit_tests/ icon_tests.dm (again, frozen) ## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: Excepted icon states: [...] ## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: spiderbot-chassis - 17 - [0x600b431] ## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: spiderbot-chassis-posi - 22 - [0x600b432] ## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: spiderbot-chassis-mmi - 21 - [0x600b433] ## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: spiderbot-smashed - 17 - [0x600b434] [...] ## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: Valid icon states: [...] ## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: spiderbot-chassis - 17 - [0x600b431] ## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: spiderbot-chassis-posi - 22 - [0x600b432] ## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: spiderbot-chassis-mmi - 21 - [0x600b433] ## UNIT_TEST ##: --- DEBUG --- [ICON STATE - Robot shall have eyes for each icon state]: spiderbot-smashed - 17 - [0x601bc24] [...] ## UNIT_TEST ##: Eye icon state eyes-spiderbot-smashed - 17 is missing. Different refs, different string tree entries, "different" strings?
 Aug 11 2016, 6:06 pm Sounds like something is messing up the string tree.