Skip to content

fix: improve update process by ensuring proper service stop and relau…#250

Merged
DanielLavrushin merged 11 commits into
mainfrom
1-67-2-fixes
Jun 10, 2026
Merged

fix: improve update process by ensuring proper service stop and relau…#250
DanielLavrushin merged 11 commits into
mainfrom
1-67-2-fixes

Conversation

@DanielLavrushin

Copy link
Copy Markdown
Owner

…nch, add update logging

Copilot AI review requested due to automatic review settings June 10, 2026 10:26
@codacy-production

codacy-production Bot commented Jun 10, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 8 high · 1 medium

Alerts:
⚠ 9 issues (≤ 0 issues of at least minor severity)

Results:
9 new issues

Category Results
BestPractice 1 medium
ErrorProne 2 high
Security 6 high

View in Codacy

🟢 Metrics 86 complexity

Metric Results
Complexity 86

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the Web UI-driven update flow by adding a persistent per-update log file and making the installer’s update action more robust at stopping the old process and ensuring the updated binary is actually running afterward.

Changes:

  • Expanded container detection and added a dedicated update.log path plus handler-side update session logging.
  • Propagated B4_UPDATE_LOG into the installer to capture timestamped, color-free logs even in quiet mode.
  • Improved update behavior to stop lingering processes and attempt a direct relaunch when the service manager doesn’t restart b4.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/http/handler/system.go Adds update log path selection + handler-side update logging, passes B4_UPDATE_LOG, and reaps update helper process to avoid zombies.
installer/lib/utils.sh Adds helpers to capture running cmdline and relaunch b4 after update.
installer/lib/log.sh Adds _log_emit to mirror logs into B4_UPDATE_LOG regardless of quiet mode.
installer/actions/update.sh Stops service then force-stops lingering process, and relaunches b4 if it didn’t come back up.
install.sh Regenerated installer with the same logging + relaunch logic for Web UI updates.
changelog.md Documents the update reliability fixes and addition of an update log.
Comments suppressed due to low confidence (1)

src/http/handler/system.go:415

  • Errors opening the update log file are ignored. If OpenFile fails (e.g., permissions), stdout/stderr will be nil and you’ll lose the installer output without any warning. Consider logging the failure and falling back to /dev/null (and use os.DevNull for portability).
		devNull, _ := os.Open("/dev/null")
		logFile, _ := os.OpenFile(logPath, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)

		cmd.Stdin = devNull
		cmd.Stdout = logFile
		cmd.Stderr = logFile

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/http/handler/system.go
Comment thread installer/lib/utils.sh
Comment thread installer/lib/utils.sh
Comment thread install.sh
Comment thread install.sh
Comment thread changelog.md Outdated
Copilot AI review requested due to automatic review settings June 10, 2026 11:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.

Comment thread src/http/handler/system.go
Comment thread src/http/handler/system.go
Comment thread src/config/bind.go Outdated
Comment thread installer/lib/utils.sh
Comment thread install.sh
… logging changes and update process

fix: enhance relaunch logic to prevent globbing issues during command execution
test: add unit test for stripCLIOverrides to validate error-file handling
- Added new properties to DNSConfig: doh_url, dc_fallback_enabled, and dc_fallback_url.
- Updated Logging configuration to include directory instead of error_file.
- Introduced new properties in RoutingConfig: block_action and ip_version.
- Added udp property to relevant configurations.
- Expanded tests description to include new test types: dns-availability, sni, and telegram.
- Introduced router_ips property for device information.
- Added ip_version property to payload files configuration.
…h and handling errors during log directory creation and file writing
Copilot AI review requested due to automatic review settings June 10, 2026 13:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 29 out of 30 changed files in this pull request and generated 3 comments.

Comment thread src/main.go Outdated
Comment thread installer/services/_interface.sh
Comment thread install.sh
…tructure and improve error logging initialization

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 29 out of 30 changed files in this pull request and generated 1 comment.

Comment thread src/log/log.go Outdated
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 29 out of 30 changed files in this pull request and generated no new comments.

@DanielLavrushin DanielLavrushin merged commit 1269652 into main Jun 10, 2026
2 of 3 checks passed
@DanielLavrushin DanielLavrushin deleted the 1-67-2-fixes branch June 10, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants