Giter VIP home page Giter VIP logo

Comments (4)

DoumanAsh avatar DoumanAsh commented on August 16, 2024

Too many open file

This error stands for you hitting soft cap on number of file descriptors
You can configure it by ulimit -n <new_cap>
Library code cannot work around this limit

I suppose that problem is in too many reassignments of interval variable.

In your code example I do not see many reassignments
Please note that Interval::wait just performs restart of underlying timer, it doesn't re-created

Interval:
https://github.com/DoumanAsh/async-timer/blob/master/src/interval.rs#L63-L66

TimerFd:
https://github.com/DoumanAsh/async-timer/blob/master/src/timer/async_tokio1.rs#L200-L203

So if you run this task multiple times, I recommend to avoid doing so and instead limit intervals (if you cannot expect control over ulimit)

If you want unlimited timers, it is better to use tokio builtin timers even if they have lower accuracy, it is still pretty decent because on Linux it relies on epoll

from async-timer.

wujekbrezniew avatar wujekbrezniew commented on August 16, 2024

Thanks for your response.
I decided to increase ulimit for open files. Tokio timers have to low resolution for me as i drive stepper motors.

from async-timer.

DoumanAsh avatar DoumanAsh commented on August 16, 2024

Understood, but please note that while timerfd provides best latency, you should prefer to switch to real time scheduler
Even if Linux only imitates it, it stills provides much less opportunity for delayed wakeups than default scheduler.

I would also recommend to only use user space application as proof of concept, as it seems your goal is to develop driver rather than just simple application.
So driver might be more suitable as you avoid going through syscalls when manipulating hardware

from async-timer.

DoumanAsh avatar DoumanAsh commented on August 16, 2024

On site note, if you use sysfs interface you can benefit from using AsyncFd to use async IO
https://docs.rs/tokio/1.32.0/tokio/io/unix/struct.AsyncFd.html

Most of the time sysfs file descriptiors are poll friendly because it is not real file, but rather special interface to access driver commands.

from async-timer.

Related Issues (10)

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.