.Net System.AccessViolationException when calling OMMProvider.Submit on a RespMsg containing a stat
I have a provider which has multiple clients connecting and each requesting a set of RICs. If they overlap (i.e. the 2nd client requests a RIC that the first client is already watching), and the response was a status message (i.e. a price wasn't available), then I attempt to replay a status message using the method below:
public OMMSolicitedItemCmd ReplayStatus(RequestToken requestToken, AttribInfo info)
{
_manager.LogDebugMessage($@Sending stored status for {RIC} to {requestToken.Handle}.);
var attribInfo = info.Clone();
var respMsg = new RespMsg
{
MsgModelType = RDM.MESSAGE_MODEL_TYPES.MMT_MARKET_PRICE,
RespType = RespMsg.RespTypeEnum.Status,
RespStatus = RespStatus,
AttribInfo = attribInfo,
IndicationMask = 0,
RespTypeNum = RDM.INSTRUMENT_UPDATE_RESPONSE_TYPES.INSTRUMENT_UPDATE_UNSPECIFIED
};
var solItemCmd = new OMMSolicitedItemCmd
{
Msg = respMsg,
RequestToken = requestToken
};
return solItemCmd;
}
The original RespStatus came from an initial message returned to the first client, but it doesn't have a clone() method. All the other properties of the constructed RespMsg are simple types (enums etc) except the AttribInfo (which is freshly cloned).
Sometimes, when one of these messages is submitted to the provider, we get an AccessViolation. Any ideas what is causing this?
Thanks, Tony.
Best Answer
-
After some communication with Premium Support, a solution where I store my own managed RespStatus. Our solution with this has now been tested for a couple of weeks and appears to have fixed the issue.
Attached is the class I used for our managed clone of the RespStatus, which other developers are welcome to use (hopefully, it'll save you some time fixing the same problem).
It contains the managed storage for the enums & string contained in the RespStatus, with a "copy constructor" to create itself from a RespStatus and a method to re-create the RespStatus.
1
Answers
-
One thing that I can think of is the object may be collected by the garbage collector.
It was mentioned in the Advanced .NET Debugging book that, in the release build, the JIT compiler can get rather aggressive and consider a local variable dead even before it goes out of scope (assuming it is not being used).
If this problem doesn't happen in the debug build, this could be the issue.
You can try to pin the object with the GCHandle.Alloc method.
GCHandle h1 = GCHandle.Alloc(obj, GCHandleType.Pinned);
...
h1.Free()0 -
Hi Alex,
I'm still working on the suggested solution, but initial testing indicates it hasn't fixed the problem. Will let you know when I have more information, thanks, Tony.
0 -
Hello @tony.mudd
Did you submit a query via Contact Premium Support yet? If so, could you please share us the ticket id?
0 -
I have now raised a Contact Premium Support case: RDC 08110361
Thanks, Tony.
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛