Panic will appear when running this demo.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Start by running the Go demo from the issue and reproducing the panic. Then inspect the elevator lookup around searchPoint = layer.nodes[*elevator]; done means the shown demo completes without panicking and the cause at that lookup is addressed.
Written by the indexing model from the issue text.
Description
Panic will appear when running this demo.
package main
import (
"math/rand"
"sync"
"time"
"github.com/coder/hnsw"
)
var (
idToEmb = map[int64][]float32{
8832462: {0.16308737, -0.015082314, -0.13542788, 0.0050275815},
8836285: {0.12513474, -0.01645081, -0.18823123, 0.0038108851},
8833448: {0.12430125, -0.028154016, -0.16484132, -0.013979792},
8835979: {0.11317906, -0.015129599, -0.081378885, 0.14409661},
8833623: {0.047779884, -0.01809181, -0.11893867, -0.042758342},
8836020: {0.16370028, -0.018596498, -0.13393748, -0.025386846},
8833095: {0.13081397, -0.011383214, -0.043572865, 0.007917681},
105126: {0.087190986, -0.013881853, -0.16933066, 0.09613177},
}
)
func test2() {
g := &hnsw.Graph[int64]{
Distance: hnsw.CosineDistance,
Rng: rand.New(rand.NewSource(time.Now().UnixNano())),
M: 32,
Ml: 0.28,
EfSearch: 300,
}
wg := sync.WaitGroup{}
mtx := sync.Mutex{}
for id, emb := range idToEmb {
wg.Add(1)
go func(id int64, emb []float32) {
mtx.Lock()
g.Add(hnsw.MakeNode(id, emb))
mtx.Unlock()
wg.Done()
}(id, emb)
}
wg.Wait()
for id, emb := range idToEmb {
g.Add(hnsw.MakeNode(id, emb))
}
}
func main() {
test2()
}
There should be something wrong here.
if elevator != nil {
searchPoint = layer.nodes[*elevator]
}
- Dominant language
- Go
- Stars
- 240
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from coder/hnsw
-
question
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
question
Difficulty 5/5 Over a week Newbie friendliness 20/100
Similar issues
-
fix(handlers): explicitly set Content-Type header in static Index handlerPossibly taken @kage-zero claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Quick Open: restore dependency-directory exclusions in filesystem fallbackPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
eugenioenko/ttt#1206 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
open-policy-agent/opa#9426 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
rorkai/App-Store-Connect-CLI#3192 ·
Maintainers usually reply within 1 day
-
t:urlDecodeUni does not map U+3002 and U+FF61 to a dot, unlike ModSecurityPossibly taken @fzipi claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day