While you are absolutely correct that there is a bug here, there is also a very simple workaround.
?
I described this in some detail in the thread where we discussed it back in September 2022: /g/twsapi/topic/93660462
?
In particular see my two posts on 16 September.
?
The bottom line is that what causes the problem is requesting market data for a particular contract, then disconnecting the API (without cancelling the data) before any other client requests the same market data.
?
And the simple workaround is: always cancel market data before disconnecting from the API.
?
In fact this is actually overkill: it¡¯s only strictly necessary to cancel the data before disconnecting when this is the first request for that contract and no other client has yet made the same request; but always cancelling before disconnecting is simple to implement, and of course in general there¡¯s no way your client program can know whether any other client has made the same request.