GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dsidorov/netty-epoll-timer-example: An example Netty server with a native profiler component demonstrating Epoll timer delay

BranchesTags
Open more actions menu

Latest commit

 

History

3 Commits
3 Commits

Folders and files

NameName
Last commit message
Last commit date
src/main
src/main
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

Repository files navigation

An example Netty server with a native profiler component, that sets a signal timer, and interrupts Epoll event loop threads every second. This is a test set up to reproduce an issue with delayed Epoll scheduled tasks, described in netty/netty#14368.

To reproduce the bug:

  1. Build the package on a Linux x86_64 or arm_64 platform:
mvn package
  1. Run the app:
java -jar lib/epoll-timer-example-1.0-SNAPSHOT.jar
  1. Wait until it blocks all non event loop threads, and starts waking up on a Netty's Epoll event loop thread:
11:33:59.363 [DEBUG] (3967243) PROFILER: setting up signal handlers
11:33:59.363 [DEBUG] (3967243) PROFILER: arming timer with 1000ms interval
11:33:59.397 [DEBUG] (3967272) PROFILER: enabling sampling
11:33:59.402 [INFO] (main) org.example.EpollTimerExample: listening on port 8000
11:34:00.363 [DEBUG] (3967242) PROFILER: sampling disabled for this thread, block and pause ...
11:34:01.363 [DEBUG] (3967243) PROFILER: sampling disabled for this thread, block and pause ...
11:34:02.364 [DEBUG] (3967244) PROFILER: sampling disabled for this thread, block and pause ...
...
11:34:28.364 [DEBUG] (3967272) PROFILER: woke up, taking a sample
11:34:29.363 [DEBUG] (3967272) PROFILER: woke up, taking a sample
11:34:30.363 [DEBUG] (3967272) PROFILER: woke up, taking a sample
...
  1. Run an HTTP request to http://localhost:8000/
  2. Watch the logs for "setting timer" message, and see how it never goes off because the event loop wait operation is interrupted and restarted every second.
...
11:34:31.841 [INFO] (Thread-0) org.example.EpollTimerExample: GET /ping
11:34:31.841 [INFO] (Thread-0) org.example.EpollTimerExample: setting timer: 2 SECONDS
11:34:32.364 [DEBUG] (3967272) PROFILER: woke up, taking a sample
11:34:33.363 [DEBUG] (3967272) PROFILER: woke up, taking a sample
11:34:34.363 [DEBUG] (3967272) PROFILER: woke up, taking a sample
...
  1. The scheduled task only gets executed when there are some I/O (non-timer) events in the Epoll interest group. For example, when a new HTTP request comes in, it generates a read event on the socket, and completes the epoll_wait call successfully. This triggers the last scheduled timer, but it blocks again on the next one:
...
11:34:37.911 [INFO] (Thread-0) org.example.EpollTimerExample: BEEP! after 6069ms
11:34:37.912 [INFO] (Thread-0) org.example.EpollTimerExample: GET /ping
11:34:37.912 [INFO] (Thread-0) org.example.EpollTimerExample: setting timer: 2 SECONDS
11:34:38.363 [DEBUG] (3967272) PROFILER: woke up, taking a sample
11:34:39.363 [DEBUG] (3967272) PROFILER: woke up, taking a sample
11:34:40.363 [DEBUG] (3967272) PROFILER: woke up, taking a sample
...
  1. For reference: re-run the application with disabled Epoll wait threshold, and see how the 2 second timer goes off after every HTTP request:
java -Dio.netty.channel.epoll.epollWaitThreshold=0 -jar lib/epoll-timer-example-1.0-SNAPSHOT.jar

About

An example Netty server with a native profiler component demonstrating Epoll timer delay

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.