Giter Site home page Giter Site logo

Comments (2)

bartdesmet avatar bartdesmet commented on August 18, 2024

The only reason I can envision for this to happen is if a) System.Reactive.PlatformServices.dll is not deployed alongside your application and b) you're running on a platform where the TPL does not have proper support for stack probing to avoid stack overflows.

What happens here is that System.Reactive.Core uses the Concurrency Abstraction Layer (CAL) to run a timer for the TimeSpan obtained from the Generate time selector function. If you're using the Portable Library version of Rx, the default implementation uses Task.Delay to run a timer. That is, unless the Platform Enlightenment Provider succeeds to load System.Reactive.PlatformServices.dll for your specific target platform, i.e. from the binaries deployed alongside your application. If such a custom set of enlightenments is retrieved, behavior could be upgraded to use System.Threading.Timer instead.

However, if the default behavior is used, Task.Delay for anything less than a millisecond will return a task that completes immediately. The timer appends a continuation with the ExecuteSynchronously flag set to the delayed task. In case the task completes immediately, that causes the continuation to run inline, hence growing the stack. For all modern desktop platforms, the TPL has functionality to use a "stack guard" to check whether there's enough stack space left. If not, it will not honor the request to execute synchronously and will jump to a different threadpool thread instead. If stack probing isn't present (e.g. because there's no P/Invoke to the underlying Win32 APIs, something being addressed in Core CLR by adding runtime support to do the checks), there may be an overflow. I need to double-check which platforms could be affected by this.

If you could provide more information on the platform used and the application configuration (i.e. whether you're using the Portable Library build with or without a PlatformServices copy alongside of it), that'd be helpful to get to the root cause.

from reactive.

bartdesmet avatar bartdesmet commented on August 18, 2024

We checked a couple of different configurations but couldn't reproduce the issue. Closing it for now. Feel free to reopen if you got more information that'd help to repro.

from reactive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.