Skip to main content

All Questions

Tagged with
0 votes
2 answers
48 views

golang concurrency deadlock issue

In one part of my flow, I created a buffered channel. Inside the doWork function, there are cases where it needs to execute itself again. However, the code below results in an "all goroutines are ...
Jed 's user avatar
  • 89
0 votes
0 answers
47 views

server Stuck, in Golang, not getting response

I am new to Golang and am trying to build a Redis server in Go. The code was working before the parsing logic with concurrency. This parsing logic is sending the response fine. Now suddenly am not ...
ajay_edupuganti's user avatar
-2 votes
1 answer
57 views

is double checked locking implementation in go valid

This is another don't be smart GO question. of course there is once primitive and that could be used, but this is purely for discussion purposes. type impl struct { fLock *sync.Mutex ...
zinking's user avatar
  • 5,655
1 vote
0 answers
60 views

Why does this optimistic lock fails?

I was experimenting with optimistic locks and wrote this for hset, under heavy load of events trying to update the same key, observed TxFailedErr(redis: transaction failed) from redis client which is ...
kryo's user avatar
  • 11
-3 votes
1 answer
39 views

FanIn pattern blocks when trying to send and receive simultaneously [duplicate]

package main import ( "fmt" ) func main() { even := make(chan int) odd := make(chan int) quit := make(chan int) fanin := make(chan int) go send(even, odd, quit) ...
Блабла Блаблов's user avatar
0 votes
2 answers
59 views

Different Behaviors in Go Race Condition Scenarios

I'm trying to understand why two similar pieces of code behave differently. Both snippets create a large number of goroutines that try to append to the same slice concurrently, which I understand is a ...
Husin Wijaya's user avatar
  • 1,457
0 votes
1 answer
76 views

Two golang goroutines sending messages to the same channel result in a 10-fold increase in time consumption?

Why is there such a significant difference in the time taken for sending and receiving data through a channel between two goroutines? golang version 1.18 this is my code package main import ( &...
cheng xu's user avatar
-1 votes
2 answers
93 views

What problems might arise from ignoring this race condition?

I wish to represent a service that receives triggers to run a particular task, however it only runs that task once at a given time while ignoring concurrent triggers. My brain came up with an ...
shampu's user avatar
  • 51
2 votes
0 answers
46 views

concurrent kafka client offset commit management data structure [closed]

Question: Comparing Ring Buffer with Hash Map and Interval Designs for Kafka Client - Which is Better? I'm working on optimizing a Kafka client for high-throughput message processing. We're ...
Jack Peng's user avatar
  • 610
0 votes
1 answer
46 views

Go channel sometimes not receiving the last value

I'm currently learning go channels, and I'm trying out this piece of code. It creates 10 goroutines which sends a 1000 1s each to a channel. Then another go routine receives it and adds it to a ...
razzz's user avatar
  • 13
0 votes
0 answers
74 views

Request Chunks from the peer in parallel in golang over a tcp connection

I'm building a P2P file transfer system in Go that fetches chunks of data from peers in parallel. While sequential requests work fine, parallel requests using goroutines behave inconsistently, ...
Tarun Kavipurapu's user avatar
0 votes
1 answer
262 views

Performance in Go: Mutex vs RWMutex

There are two types of mutex in Go: Mutex and RWMutex Mutex offers func Lock() and func Unlock(). RWMutex offers those functions plus func RLock() and func RUnlock(). From what I understand, we ...
tbmsilva's user avatar
  • 467
-1 votes
1 answer
55 views

GO Cond - fmt.Println after wg.Done ended up dead lock

Unable to understand this dead lock situation in golang, i have below to go code with pub and sub pattern package main import ( "fmt" "sync" ) func main() { cond := ...
Hari's user avatar
  • 1,613
1 vote
1 answer
41 views

How to implement ordered fan-in (proper message passing for my language)?

I'm the creator of https://github.com/nevalang/neva It's a dataflow programming where you have nodes that do message passing through ports. I use go channels to implement that. However, I faced an ...
emil14's user avatar
  • 81
-1 votes
1 answer
75 views

Is sync.Map LoadOrStore subject to race conditions?

I'm using sync.Map's LoadOrStore method in Go. I'm trying to understand if there could be a race condition leading to multiple evaluations of the value creation function. I'm trying to understand if ...
Zanko's user avatar
  • 4,654

15 30 50 per page
1
2 3 4 5
93