Automated summary
Finds blocking calls in a Spring WebFlux codebase (.block(), Thread.sleep, blocking I/O, JDBC) that can cause thread starvation or performance degradation.
Strengths
- Very concrete pattern list covering direct Mono/Flux blocking, locks, blocking I/O and JDBC/JPA access.
- Context-aware triage that separates acceptable blocking (StructuredTaskScope, @Scheduled, tests, boundedElastic) from blocking on the event loop.
- Catches classic reactive anti-patterns such as blocking inside map or flatMap, together with the expected offloading fix.
- Accounts for Java 24 virtual threads and the project's OkHttp usage.
Limitations
- Purely textual Grep-based analysis: no runtime profiling and no real event-loop thread detection.
- Can be noisy, since broad patterns like synchronized, .get() or .save() surface out of context.
- The listed acceptable patterns are specific to one project and must be adapted elsewhere.
Use it during a reactive code review or a performance investigation on an existing Spring WebFlux application.
Skip it for classic imperative code, non-Spring/WebFlux projects, or when you need real performance measurements rather than a static audit.
Security analysis
SafeThe skill provides static analysis guidance for identifying blocking calls in reactive code. It does not instruct any destructive actions, data exfiltration, or execution of commands. It only advises using Grep and manual review, posing no execution risk.
No concerns found
How this analysis is madeExamples
Scan our Spring WebFlux modules for blocking calls that could starve the Netty event loop, and list each finding with its file, line and whether it's acceptable or problematic.Check the controllers and services under src/main/java for blocking calls inside map or flatMap operators and show me the boundedElastic fix for each one.Find every .block() call in this project and tell me which ones run inside StructuredTaskScope or virtual threads and are therefore fine to keep.name: profile-blocking description: Find blocking calls in reactive WebFlux code that can cause performance issues and thread starvation
Profile Blocking Skill
Identify blocking calls in the reactive codebase that can cause thread starvation, deadlocks, and performance degradation in Spring WebFlux applications.
Instructions
1. Search for Blocking Patterns
Use Grep to search for these blocking call patterns:
Direct Blocking Calls
.block() // Mono/Flux blocking subscription
.blockFirst() // Flux blocking first element
.blockLast() // Flux blocking last element
.blockOptional() // Mono blocking to Optional
.toFuture().get() // CompletableFuture blocking
.get() // Future.get() blocking
.join() // CompletableFuture.join()
Thread Blocking
Thread.sleep( // Thread sleep
Object.wait( // Object monitor wait
.await( // CountDownLatch, CyclicBarrier await
.acquire( // Semaphore blocking acquire
synchronized // Synchronized blocks (potential)
ReentrantLock.lock // Explicit locking
Blocking I/O
InputStream // Blocking input streams
OutputStream // Blocking output streams
FileInputStream // File I/O
FileOutputStream // File I/O
BufferedReader // Blocking readers
Scanner // Blocking scanner
new URL( // URL.openStream() is blocking
HttpURLConnection // Blocking HTTP
JDBC/Database (if present)
JdbcTemplate // Blocking JDBC
EntityManager // Blocking JPA
.save( // Repository blocking save
.findBy // Repository blocking find
DataSource // Direct datasource access
2. Context-Aware Analysis
For each finding, determine if it's:
Acceptable blocking:
- Inside
StructuredTaskScope(this project uses Java 24 virtual threads) - In
@Scheduledmethods running on separate thread pool - In test code
- Wrapped in
Mono.fromCallable()with.subscribeOn(Schedulers.boundedElastic()) - In startup/initialization code (non-request path)
Problematic blocking:
- In
@RestControllermethods returningMono/Flux - In reactive chain operators (map, flatMap, filter)
- On Netty event loop threads
- In
WebFilterimplementations - Inside
Mono.create()orFlux.create()without scheduler
3. Analyze Reactive Chains
Check for anti-patterns in reactive code:
// BAD: Blocking in map
mono.map(data -> {
blockingCall(); // Blocks event loop!
return result;
})
// BAD: Blocking in flatMap
flux.flatMap(item -> {
var result = blockingService.call(); // Blocks!
return Mono.just(result);
})
// GOOD: Proper offloading
mono.flatMap(data ->
Mono.fromCallable(() -> blockingCall())
.subscribeOn(Schedulers.boundedElastic())
)
4. Check This Project's Specific Patterns
Files to examine:
src/main/java/**/controller/*.java- REST endpointssrc/main/java/**/service/*.java- Service layersrc/main/java/**/strategy/*.java- Strategy implementationssrc/main/java/**/config/*.java- Configuration classes
Known acceptable patterns in this project:
StructuredTaskScopeusage inAggregatorService(virtual threads).block()inside virtual thread contexts- OkHttp calls (executed in separate thread pool)
Patterns to flag:
.block()in controller methods- Blocking in
WebFilterorHandlerFilterFunction - Synchronous HTTP calls without proper scheduling
5. Virtual Thread Considerations
This project uses Java 24 with virtual threads. Check:
// Virtual thread factory usage
Thread.ofVirtual().factory()
// StructuredTaskScope usage (blocking is OK inside)
try (var scope = new StructuredTaskScope.ShutdownOnFailure()) {
scope.fork(() -> blockingCall()); // OK - virtual thread
scope.join(); // OK - virtual thread blocks, not platform thread
}
6. HTTP Client Analysis
Check OkHttp usage patterns:
// Synchronous call - check if on reactive thread
Response response = client.newCall(request).execute();
// Better: Use async
client.newCall(request).enqueue(callback);
// Or wrap properly
Mono.fromCallable(() -> client.newCall(request).execute())
.subscribeOn(Schedulers.boundedElastic())
Output Format
## Blocking Call Analysis Report
### Summary
| Category | Count | Severity |
|----------|-------|----------|
| Direct .block() calls | X | High/Medium |
| Thread.sleep() | X | High |
| Blocking I/O | X | Medium |
| Synchronized blocks | X | Low |
| **Total potential issues** | **Y** | |
### Critical Issues (Event Loop Blocking)
#### [Issue Title]
**File**: `path/to/file.java:line`
**Pattern**: `.block()` in reactive chain
**Context**: Inside @RestController endpoint
**Risk**: Thread starvation, request timeouts
```java
// Current code
@GetMapping("/data")
public Mono<Data> getData() {
return service.fetchData()
.map(d -> blockingTransform(d)); // BLOCKS!
}
Fix:
@GetMapping("/data")
public Mono<Data> getData() {
return service.fetchData()
.flatMap(d -> Mono.fromCallable(() -> blockingTransform(d))
.subscribeOn(Schedulers.boundedElastic()));
}
Medium Priority (Potential Issues)
| File | Line | Pattern | Context | Verdict | |------|------|---------|---------|---------| | Service.java | 42 | .block() | Inside StructuredTaskScope | OK | | Handler.java | 78 | Thread.sleep | Test code | OK |
Acceptable Blocking (Verified Safe)
These blocking calls are in appropriate contexts:
| File | Line | Pattern | Why It's OK | |------|------|---------|-------------| | AggregatorService.java | 120 | .block() | Inside virtual thread scope | | ForecastService.java | 85 | OkHttp.execute() | Wrapped in fromCallable |
Patterns Found
.block() Calls
src/main/java/.../Service.java:42 - response.block()
src/main/java/.../Service.java:87 - result.blockFirst()
Thread Blocking
src/main/java/.../Worker.java:23 - Thread.sleep(1000)
Blocking I/O
src/main/java/.../Reader.java:15 - new FileInputStream()
Recommendations
- Immediate: Move blocking call at
File.java:42to bounded elastic scheduler - Review: Verify StructuredTaskScope usage covers all blocking in AggregatorService
- Consider: Replace synchronous OkHttp with async calls or WebClient
Reactive Best Practices Checklist
- [ ] No .block() in @RestController methods
- [ ] No .block() in WebFilter implementations
- [ ] Blocking I/O wrapped with boundedElastic scheduler
- [ ] Thread.sleep() only in tests or scheduled tasks
- [ ] Synchronized blocks minimized and not in hot paths
- [ ] HTTP clients properly configured for async or offloaded
## Execution Steps
1. Use `Grep` to find all `.block()` calls
2. Use `Grep` to find `Thread.sleep`, `.await(`, `synchronized`
3. Use `Grep` to find blocking I/O patterns
4. Read each file to determine context (controller vs service vs test)
5. Check if blocking is inside StructuredTaskScope or virtual thread
6. Categorize findings by severity
7. Generate report with fix recommendations
## Notes
- Virtual threads (Java 21+) change the blocking calculus - blocking is OK on virtual threads
- This project uses StructuredTaskScope, so verify scope boundaries
- OkHttp is blocking by default but may be acceptable if not on event loop
- Focus on request-handling paths; scheduled tasks are lower priority
- Some `.block()` in tests is normal and acceptable
- Spring WebFlux Netty uses limited event loop threads - blocking them is critical
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/profile-blocking-calls-in-webflux-mm78nodg/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/profile-blocking-calls-in-webflux-mm78nodg/download' --output '.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg/SKILL.md.part' && mv '.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg/SKILL.md.part' '.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg/SKILL.md' && test -s '.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/profile-blocking' && cp -R '.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg' '.claude/skills/profile-blocking'Cursor
test -f '.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg/SKILL.md' && test -s '.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/profile-blocking' && cp -R '.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg' '.cursor/skills/profile-blocking'Codex
test -f '.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg/SKILL.md' && test -s '.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/profile-blocking' && cp -R '.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg' '.agents/skills/profile-blocking'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/profile-blocking-calls-in-webflux-mm78nodg'openskills read 'profile-blocking-calls-in-webflux-mm78nodg'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/profile-blocking-calls-in-webflux-mm78nodg/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.