openwrt / openwrt/packages

`nginx-util init_lan` freezes

Open
#18,904 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

stale
Dominant language
Makefile
Stars
4.6k
Forks
4k
Avg merge
3d 12h
Merged PRs (30d)
134

Description

Not sure about the trigger but on my system nginx-util init_lan sometimes freezes. After analyzing the source code, and checking the files in /var/lib/nginx it looks to me like line 229 (create_lan) is executed but line 239 (init_uci) isn't. Also, the exception handler at line 222 is triggered. Therefore I conclude that the configuring.lock() at line 236 deadlocks. Let's look at the unlock configuring.unlock() at line 219:

https://github.com/openwrt/packages/blob/2ac03c237243e8a726b656d1d4c0e2d741f34c32/net/nginx-util/src/nginx-util.cpp#L219

If line 217 or 218 (rather than 220) throws an exception, then the code would deadlock. At least that's my interpretation, I may be wrong.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in nginx-util.cpp around lines 217-239 and trace the exception path through create_lan and init_uci, especially the configuring.lock() and configuring.unlock() calls. Run nginx-util init_lan under the affected conditions and verify that exceptions do not leave the lock held and that the command no longer freezes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, nginx
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.