Commit Graph
31 Commits
Author SHA1 Message Date
Mohammad Arham 40e44db597 Fix: Added GCHandle in attempt to fix ui crash 2025-01-22 02:15:55 -05:00
John Colvin fd9892c6b6 fix: Prevent raw_pb_callback premature garbage collection
Bugs (fixed):
   * Startup crash w/ error message: "A callback was made on a garbage
     collected delegate of type ApiNativeMethods.raw_pb_callback"

   Cause: The callback is only referenced in unmanaged c++. Without references
   in managed code, the Garbage Collector deems the delegate eligible for
   collection before the callback has finished execution.

   Note: The original solution forced a reference in managed code by storing it
   in a class-member 'keepalive' dictionary, whose life isn't bound to the
   [synchronous] scope of the 'send' method. The callback would then remove
   itself from the dictionary in its last line of code. While this reduced the
   chance of such an error occurring, occassional crashes persisted
   (particularly in low-bandwidth environments). I suspect the frequency at
   which garbage-collector threads run is inversely related to the frequency
   at which data arrives from the server, as the latter triggers execution of
   higher-priority threads.

   Steps to repro:
      1. Insert a Thread.Sleep statement (1000 ms should be sufficient) after
         the call that removes the last reference to the delegate (i.e., make
         the thread sleep for a significant amount of time in the callback
         AFTER it becomes eligible for garbage collection).

      2. Build, run, and observe crash on startup.

   Solution: Wrap the callback in another class, and store the wrapper
   in the dictionary rather than the callback itself. The reason why this
   works isn't totally clear, however its effectiveness has been verified
   with the repro (described above).
2022-12-23 11:25:07 -05:00
John Colvin 306b56a999 fix (hopeful): Make sure callback disposed after subscription
Hopefully this fixes the 'Garbage Collected callback' crash on login
2022-09-02 09:45:02 -05:00
John Colvin 6874c8f6b9 style: Use dos line endings in QuickBusClientChannel.cs 2021-12-29 13:18:49 -05:00
Michael Harding 3e822bcca1 Merge branch 'master' into spreader_test 2019-05-01 10:58:30 -04:00
Eric Harding adec1bdfd0 SPARK-678 Dont' crash on null array 2019-04-10 10:57:44 -04:00
Jake Norbut f6eb1e4745 QuickBusClientChanel diag logging for sub / unsub 2019-03-14 15:53:12 -05:00
Kevin Darby 0419d084f4 moved co2 stuff down to spark_api to refactor or remove MarketDataClient.cs 2018-12-06 15:01:40 -05:00
Eric Harding 09d4d1f907 SPARK-1901 ServiceContext.login( existing token). 2018-12-06 14:09:50 -05:00
Eric Harding 69b75c5f5e SPARK-1901 Protobuf doesn't want null here 2018-12-05 14:08:28 -05:00
Eric Harding 5626614e2d SPARK-1901 Delegates don't do anything if they aren't used 2018-12-05 13:54:21 -05:00
Eric Harding 67d0a0351a SPARK-1901 Fix race with server startup in c# api client 2018-12-05 13:36:20 -05:00
Eric Harding 0bdd2dfca0 Api: centralize formatting stream topic+qualifier 2018-12-05 11:33:13 -05:00
Eric Harding a0c572ef2e Remove generated call to format_qualifier 2018-12-05 11:08:25 -05:00
Eric Harding b5c24880a1 SPARK-1901 - Send qualifier to stream access check 2018-12-05 10:51:37 -05:00
Eric Harding d652646e93 SPARK-1906 Stream Auth : C# Server 2018-11-30 17:22:42 -05:00
Eric Harding 86199755f5 SPARK-1906 Stream Auth : C# Client 2018-11-30 17:05:37 -05:00
Eric Harding 3bbef9f328 SPARK-1905 Attach token to api header C# 2018-11-30 11:22:31 -05:00
Eric Harding 15feef9d23 SPARK-1509 queueing in shell 2018-08-21 16:00:33 -04:00
Eric Harding 56fc1019de SPARK-1414 Exception thrown in api subscribe context is handled silently 2018-06-21 16:56:38 -04:00
Eric Harding 40d5bee934 Spark-546 Fix the NullRef with no stack. Still not entirely sure why the ContinueWith solution doesn't work. 2018-02-23 19:40:23 -05:00
Eric Harding e236bafde1 Might help mysterious nullref problem. 2018-02-21 15:32:33 -05:00
Pedro Pinto 66cf280f1b Removed on dispose logging call to avoid crash on exit 2018-02-20 13:54:01 -05:00
Eric Harding 026e0686be spark-500. Don't throw out the client just because we unsubscribe one subscription. 2018-02-16 09:35:08 -05:00
Eric Harding 198b11efc0 spark-493 2018-02-15 15:33:06 -05:00
Eric Harding eafa6ed68d Make c# api friendlier to immutable types. Rename Result.result to Result.value 2017-11-10 11:18:45 -05:00
Eric Harding a2b33c1c9f Fix double dispose in ApiClient 2017-10-23 11:21:54 -04:00
Eric Harding 949a79039a Remove obsolete comment 2017-10-16 13:36:31 -04:00
Pedro Pinto a4e21f67f6 Merged 2017-09-30 15:00:10 +00:00
Eric Harding 2d6d93b6da Some clean up and tweaks to get the shell UI shown (finally). 2017-09-05 14:23:35 -04:00
Eric Harding e1ab224b73 Add bts_api and make it build. Still needs p/invoke fixups. 2017-08-18 17:35:36 -04:00