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

panic bug #795

Open
andyzhou opened this issue Dec 30, 2023 · 5 comments
Open

panic bug #795

andyzhou opened this issue Dec 30, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@andyzhou
Copy link

问题发生在model.go的FM:Predict()方法,运行过程中会发生fm.Index对象为空的情况,导致fm.Index.EncodeUser及相关方法调用panic。

@andyzhou andyzhou added the bug Something isn't working label Dec 30, 2023
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The problem occurs in the FM: Predict() method of model.go. During the operation, the fm.Index object will be empty, causing fm.Index.EncodeUser and related methods to call panic.

@zhenghaoz
Copy link
Collaborator

有日志吗,我看一下是具体哪个位置

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Is there any log? Let me check the specific location.

@alwinmathew
Copy link

@zhenghaoz, is there a fix for this issue? I'm also running into this.

I've a stack trace if that helps.

{"level":"info","ts":1708892182.2309608,"msg":"ranking recommendation","n_working_users":2,"n_jobs":3,"cache_size":100}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x60 pc=0x104bb8a68]

goroutine 748 [running]:
github.com/zhenghaoz/gorse/model/click.(*FM).Predict(0x1400019f5f0, {0x14000f87da0?, 0x140000dcff0?}, {0x140000dcff0, 0x24}, {0x0, 0x0, 0x104441b80?}, {0x14000268280, 0xf, ...})
	/home/runner/work/gorse/gorse/model/click/model.go:204 +0x48
github.com/zhenghaoz/gorse/worker.(*Worker).replacement(0x14000578420, 0x14001128a68?, 0x140011295d8, {0x1400166e790, 0x2, 0x0?}, 0x14000f972a0)
	/home/runner/work/gorse/gorse/worker/worker.go:1236 +0x6a4
github.com/zhenghaoz/gorse/worker.(*Worker).Recommend.func2(0x1?, 0x1)
	/home/runner/work/gorse/gorse/worker/worker.go:778 +0x2e24
github.com/zhenghaoz/gorse/base/parallel.Parallel.func2(0x0?)
	/home/runner/work/gorse/gorse/base/parallel/parallel.go:67 +0x9c
created by github.com/zhenghaoz/gorse/base/parallel.Parallel
	/home/runner/work/gorse/gorse/base/parallel/parallel.go:58 +0x130

@linguanyuanA
Copy link

func (t *FitClickModelTask) run(j *task.JobsAllocator)
if t.clickTrainSet == nil || numUsers == 0 || numItems == 0 || numFeedback == 0 {
...
log.Logger().Warn("empty ranking dataset",
zap.Strings("positive_feedback_type", t.Config.Recommend.DataSource.PositiveFeedbackTypes))
t.taskMonitor.Fail(TaskFitClickModel, "No feedback found.")
return nil
}

当numFeedback 为0时,这里会返回nil, 导致没有执行后面的 func (fm *FM) Fit(trainSet, testSet *Dataset, config *FitConfig)
结果就是fm.Init没有执行。但是离线Recommend时会调用 w.ClickModel.Predict
@zhenghaoz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants