Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

default panic: runtime error: invalid memory address or nil pointer dereference #6

Open
LukaszUrb opened this issue Oct 25, 2021 · 2 comments

Comments

@LukaszUrb
Copy link

Running code

import Amqp from 'k6/x/amqp';
import Queue from 'k6/x/amqp/queue';

export const options = {
    vus: 10,
    duration: '30s'
};


export default function () {
  console.log("K6 amqp extension enabled, version: " + Amqp.version)
  const url = "amqp://guest:guest@localhost:5672/"
  Amqp.start({
    connection_url: url
  })
  console.log("Connection opened: " + url)
  
  const queueName = 'K6 general'
  
  Queue.declare({
    name: queueName,
    // durable: false,
    // delete_when_unused: false,
    // exclusive: false,
    // no_wait: false,
    // args: null
  })

  console.log(queueName + " queue is ready")

  Amqp.publish({
    queue_name: queueName,
    body: "Ping from k6"
    // exchange: '',
    // mandatory: false,
    // immediate: false,
  })

  const listener = function(data) { console.log('received data: ' + data) }
  Amqp.listen({
    queue_name: queueName,
    listener: listener,
    // consumer: '',
    // auto_ack: true,
    // exclusive: false,
		// no_local: false,
		// no_wait: false,
    // args: null
  })
}

I'm getting an error

INFO[0000] K6 amqp extension enabled, version: v0.0.1    source=console
INFO[0000] K6 amqp extension enabled, version: v0.0.1    source=console
INFO[0000] K6 general queue is ready                     source=console
INFO[0000] K6 amqp extension enabled, version: v0.0.1    source=console
panic: runtime error: invalid memory address or nil pointer dereference [recovered]        
running panic: runtime error: invalid memory address or nil pointer dereference [recovered]
default panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x11fe10e]

goroutine 328 [running]:
github.com/dop251/goja.AssertFunction.func1.1()
        github.com/dop251/[email protected]/runtime.go:2154 +0x74
panic({0x1852c80, 0x25a9830})
        runtime/panic.go:1038 +0x215
github.com/dop251/goja.(*vm).try.func1()
        github.com/dop251/[email protected]/vm.go:511 +0x8eb
panic({0x1852c80, 0x25a9830})
        runtime/panic.go:1038 +0x215
github.com/dop251/goja.(*vm).run(0xc000e74300)
        github.com/dop251/[email protected]/vm.go:401 +0x4e
github.com/dop251/goja.(*baseJsFuncObject)._call(0xc0027cc160, {{0x1c06ce8, 0x261f1e0}, {0xc00059cf80, 0x1, 0x1}}, {0x0, 0x0}, {0x1c06ce8, 0x261f1e0})
        github.com/dop251/[email protected]/func.go:172 +0x2d8
github.com/dop251/goja.(*funcObject).call(...)
        github.com/dop251/[email protected]/func.go:180
github.com/dop251/goja.(*funcObject).Call(0x6a1d, {{0x1c06ce8, 0x261f1e0}, {0xc00059cf80, 0x1, 0x1}})
        github.com/dop251/[email protected]/func.go:140 +0xc9
github.com/dop251/goja.AssertFunction.func1.2()
        github.com/dop251/[email protected]/runtime.go:2159 +0x7d
github.com/dop251/goja.(*vm).try(0xd0d1b4, 0x10)
        github.com/dop251/[email protected]/vm.go:517 +0x1a4
github.com/dop251/goja.AssertFunction.func1({0x1c06ce8, 0x261f1e0}, {0xc00059cf80, 0xc0025e6520, 0x20001})
        github.com/dop251/[email protected]/runtime.go:2158 +0x110
github.com/dop251/goja.(*Runtime).wrapJSFunc.func1({0xc0012520a8, 0x1, 0x2})
        github.com/dop251/[email protected]/runtime.go:2027 +0x105
github.com/grafana/xk6-amqp.(*Amqp).Listen.func1()
        github.com/grafana/[email protected]/amqp.go:100 +0x107
created by github.com/grafana/xk6-amqp.(*Amqp).Listen
        github.com/grafana/[email protected]/amqp.go:98 +0x16c
PS C:\Users\lukasz.urbanski\prg_bs_local\performancetests>
@Tushar-Tiket
Copy link

Tushar-Tiket commented Oct 30, 2023

Facing the same issue when I run the load.
However issue not occurring when running less iteration (say 20 or 50) with single VU.
@mstoykov @javaducky @LukaszUrb

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
running panic: runtime error: invalid memory address or nil pointer dereference [recovered]
RabbitMQpanic: runtime error: invalid memory address or nil pointer dereference [recovered]2m0s  0078.82 iters/s
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1495ff1]

goroutine 6597 [running]:
github.com/dop251/goja.(*Runtime).runWrapped.func1()
	github.com/dop251/[email protected]/runtime.go:2516 +0x185
panic({0x21191a0, 0x3329480})
	runtime/panic.go:884 +0x213
github.com/dop251/goja.(*vm).handleThrow(0xc002605200, {0x21191a0, 0x3329480})
	github.com/dop251/[email protected]/vm.go:788 +0x497
github.com()
	github.com/dop251/[email protected]/vm.go:807 +0x45
panic({0x21191a0, 0x3329480})
	runtime/panic.go:884 +0x213
github.com/dop251/goja.(*vm).handleThrow(0xc002605200, {0x21191a0, 0x3329480})
	github.com/dop251/[email protected]/vm.go:788 +0x497
github.com/dop251/goja.(*vm).runTryInner.func1()
	github.com/dop251/[email protected]/vm.go:830 +0x45
panic({0x21191a0, 0x3329480})
	runtime/panic.go:884 +0x213
github.com/dop251/goja.(*vm).run(0xc002605200)
	github.com/dop251/[email protected]/vm.go:579 +0xb1
github.com/dop251/goja.(*vm).runTryInner(0xc002605200?)
	github.com/dop251/[email protected]/vm.go:834 +0x70
github.com/dop251/goja.(*baseJsFuncObject).__call(0xc002c86cc0, {0xc00464d3e0?, 0x1, 0x200?}, {0x0?, 0x0}, {0x26197d0?, 0x337d4c0?})
	github.com/dop251/[email protected]/func.go:426 +0x705
github.com/dop251/goja.(*baseJsFuncObject)._call(...)
	github.com/dop251/[email protected]/func.go:442
github.com/dop251/goja.(*baseJsFuncObject).call(0xc002d394c8?, {{0x26197d0, 0x337d4c0}, {0xc00464d3e0, 0x1, 0x1}}, {0x0?, 0x0?})
	github.com/dop251/[email protected]/func.go:450 +0x7a
github.com/dop251/goja.(*baseJsFuncObject).Call(...)
	github.com/dop251/[email protected]/func.go:382
github.com/dop251/goja.AssertFunction.func1.1()
	github.com/dop251/[email protected]/runtime.go:2476 +0x77
github.com/dop251/goja.(*vm).try(0xc002605200, 0xc000165698)
	github.com/dop251/[email protected]/vm.go:811 +0x244
github.com/dop251/goja.(*Runtime).runWrapped(0xc001647c00, 0x6c08518?)
	github.com/dop251/[email protected]/runtime.go:2520 +0x7c
github.com/dop251/goja.AssertFunction.func1({0x26197d0?, 0x337d4c0?}, {0xc00464d3e0?, 0xc00101c0a0?, 0x20001?})
	github.com/dop251/[email protected]/runtime.go:2475 +0x92
github.com/dop251/goja.(*Runtime).wrapJSFunc.func1({0xc0019db9f8, 0x1, 0x2?})
	github.com/dop251/[email protected]/runtime.go:2284 +0x185
github.com/grafana/xk6-amqp.(*AMQP).Listen.func2()
	github.com/grafana/[email protected]/amqp.go:195 +0x11c
created by github.com/grafana/xk6-amqp.(*AMQP).Listen
	github.com/grafana/[email protected]/amqp.go:193 +0x235

@javaducky
Copy link
Contributor

@Tushar-Tiket thank you for adding your experience to this issue. Sadly, this extension is in need of a rewrite to use the newer event loop provided by more recent releases of k6. The decision has been made to deprecate this extension as there are no maintainers available to continue what was originally a proof of concept.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants