zzwqqq opened a new issue, #1514:
URL: https://github.com/apache/flink-agents/issues/1514

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   With short-term memory TTL enabled, `getFieldNames()` can still list a field 
name after its state entry expires. `getFields()` iterates those names and 
throws `NullPointerException` when it encounters the missing entry. It should 
skip that entry and return the remaining fields.
   
   I tried filtering the names with `MapState.contains(path)`. With TTL enabled 
and the default settings, `NEVER_RETURN_EXPIRED` hides expired fields and 
`ON_READ_AND_WRITE` makes each check refresh the TTL of a live field. Flink 
2.3's public `MapState` API has no per-call option to skip that refresh. I'm 
unsure whether listing field names should extend their lifetime and would 
appreciate the maintainers' view. The `getFields()` fix is independent of that 
decision.
   
   ### How to reproduce
   
   Set `short-term-memory.state-ttl` to `100 ms` with the default visibility 
(`NEVER_RETURN_EXPIRED`). Use the same input key for all three steps.
   
   1. At 0 ms, write `old = 1` and let the action finish.
   2. At 60 ms, write `fresh = 2` and let the action finish.
   3. At 120 ms, call `ctx.getShortTermMemory().getFields()`. The expected 
result is `{fresh=2}`. The call throws a `NullPointerException` while reading 
`old`.
   
   ### Version and environment
   
   - Apache Flink Agents `main` at `7e3edf249b9d`
   - Apache Flink 2.3.0, OpenJDK 17.0.15, macOS arm64
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to