Shriram Sunder

10/28/2022, 9:45 PM
There's an issue I am facing with
's not being released. I am on a Windows 11 system, and as mentioned there's a limit of 200 connections in Windows. I've modified that to 10000 from the config file as well, yet I'm getting the following error:
panic: runtime error: invalid memory address or nil pointer dereference
        panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x40 pc=0x104dfdc]
The error code points to this section of the code:
// Go Func to insert data into the database, reads from the channel
	go func() {
		// Makes sure wg closes
		defer wg.Done()

		// Make a goroutine that will accept data from a channel and push to questDB
		ctx, cancel := context.WithCancel(context.Background())

		// Get newline sender
		sender, err := qdb.NewLineSender(ctx)

		// Defer close the sender
		defer func() {
			if err = sender.Close(); err != nil {

		// Get the values from the channel
		for res := range c {
			for _, v := range res.Results {
				err := sender.Table("aggs").
					Symbol("ticker", res.Ticker).
					StringColumn("timespan", "minute").
					Int64Column("multiplier", int64(1)).
					Float64Column("open", v.O).
					Float64Column("high", v.H).
					Float64Column("low", v.L).
					Float64Column("close", v.C).
					Float64Column("volume", v.V).
					Float64Column("vw", v.Vw).
					Float64Column("n", float64(v.N)).
					At(ctx, time.UnixMilli(int64(v.T)).UnixNano())

			// Make sure the sender is flushed
			err := sender.Flush(ctx)

		// Cancel the context
It's definitely a case of connections to the database not being closed, as there was a delay in the error, AFTER increasing the number of connections to the db. I've even tied it to the context, and it simply does not release the connection, any suggestions are welcome.