Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] function CheckAndReportBinariesStatus cannot correctly check the number of processes when encountering symbolic link directory situation #4

Open
neptunezx opened this issue Nov 7, 2024 · 0 comments

Comments

@neptunezx
Copy link

neptunezx commented Nov 7, 2024

OpenIM Server Version

3.8.1

Operating System and CPU Architecture

macOS (ARM)

Deployment Method

Source Code Deployment

Bug Description and Steps to Reproduce

If the project's directory is included in a symbolic link directory, after running mage start in the OpenIM project, CheckBinariesRunning(in CheckAndReportBinariesStatus) cannot correctly check the number of processes. The reason is that in the init function of the mageutil module, the value of the OpenIMRoot variable is obtained via os.Getwd(), which may return a path containing symbolic links, rather than the actual file path. But the underlying implementation of CheckBinariesRunning is based on the proc_pidpath function in C, which retrieves the process path as the true file path (not symbolic link paths).
It will also make the "mage stop" not work to stop processes.
It is recommended to modify the package's init function

func init() {
	currentDir, err := os.Getwd()
	if err != nil {
		panic("Error getting current directory: " + err.Error())
	}

        OpenIMRoot = currentDir

to

func init() {
	currentDir, err := os.Getwd()
	if err != nil {
		panic("Error getting current directory: " + err.Error())
	}
	currentDir, err = filepath.EvalSymlinks(currentDir)
	if err != nil {
		panic("Error resolving symlinks in current directory: " + err.Error())
	}

        OpenIMRoot = currentDir

Screenshots Link

No response

@neptunezx neptunezx changed the title [BUG] function CheckAndReportBinariesStatus cannot correctly check the number of processes when meet symbolic link directory [BUG] function CheckAndReportBinariesStatus cannot correctly check the number of processes when encountering symbolic link directory situation Nov 7, 2024
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

No branches or pull requests

1 participant