Commit Graph

74 Commits

Author SHA1 Message Date
gavrila florin
fa71d7a37a add support for own ids 2022-05-04 00:04:38 +03:00
Paul Cameron
a8f0a04c3d Fix two race conditions in client.Do
* Common race condition is fixed by identifying that Client.respHandler
  can be completely removed since all respHandler operations (get, put
  and invocation) can be moved into the Client.processLoop goroutine,
  meaning that zero locking is required. This race condition resulted
  in a deadlock that was resolved by the response timeout at the
  end of client.Do, returning ErrLostConn

* Rare race condition is fixed by changing responseHandlerMap.get
  to .getAndRemove. This race condition resulted in the innerHandler
  for a new dtJobCreated assigned in client.Do overriding a stale older
  dtJobCreated request, and the newer innerHandler being removed by an
  older dtJobCreated in client.processLoop > client.handleInner. When
  the newer dtJobCreated response was received, the handler for it had
  already been deleted. This was resolved by the response timeout at the
  end of client.Do, returning ErrLostConn
2021-05-02 11:31:19 +10:00
CodeLingo Bot
133dd3716f Fix function comments based on best practices from Effective Go
Signed-off-by: CodeLingo Bot <bot@codelingo.io>
2019-02-28 02:11:17 +00:00
Md. Ashiquzzaman
d0e6ec4878 Fix Odd use of time.Duration (#29)
Ref - https://github.com/appscode/g2/issues/28
2018-11-21 17:16:29 +01:00
Sadlil Rhythom
f2f0349d2d Remove lastcall. 2018-11-21 17:00:42 +01:00
Christoffer Fjellström
0ca6dc2c6f Remove duplicate locking
Fixes duplicated code after merge
2017-09-30 09:30:29 +02:00
No-ops
7b6215604e Merge remote-tracking branch 'upstream/master' 2017-09-29 10:51:16 +02:00
Christoffer Fjellström
99d317427f Add skipping for integration tests when running unit tests
Run integration tests with the -integration flag
2017-09-27 16:42:21 +02:00
Christoffer Fjellström
2dbf199260 Add lock on job handler assignment
Fixes race condition on jobs being done before handler is set.
2017-09-27 11:57:57 +02:00
John-Lin
e1224a8c20 fixed typo and keep WorkComplate for downward compatibility 2017-09-27 13:19:08 +08:00
Christoffer Fjellström
27942f55cd Add sync lock on do() to avoid race conditions when creating jobs 2017-02-03 10:06:27 +01:00
Christoffer Fjellström
d6791e2e42 Add sync lock to create job functions
Add sync lock to make create job calls thread safe.
2017-01-16 16:44:48 +01:00
JessonChan
dd82e211a3 concurrent map bug fixed 2016-05-06 18:00:58 +08:00
John Ku
9d99accce2 Allow built in selectionHandlers to be reused outside of package 2015-12-11 13:48:02 -08:00
John Ku
1c4b8aa000 Export pool.clients for custom Pool instantiation 2015-12-10 13:54:48 -08:00
John Ku
d20c3c7bd1 Allow custom Pool without constructor 2015-12-10 11:19:04 -08:00
Xing Xing
c6c6c9cac2 don't use sigillum 2015-07-10 20:30:35 +08:00
Endre Hirling
c615e74af8 Replace mutex in client.do() with a channel to avoid deadlock and introduce command timeout 2015-07-06 21:40:49 +02:00
Gabriel Cristian Alecu
e005ea4442 Fixed WORK_FAIL needing 2 arguments
According to http://gearman.org/protocol/ , WORK_FAIL only has 1 argument: the handle
2014-08-21 10:41:23 +03:00
Graham Barr
7bcc4de76f Do not ignore write errors 2014-08-20 11:27:32 -05:00
Graham Barr
d82da8fd71 Avoid read channel corruption when response size > bufferSize
When receiving a response, what was happening

1. Read bufferSize and it gets assigned to leftdata
2. Read another bufferSize
3. 2 buffers get appended, but leftdata still points to first buffer
4. Process data buffer which contains only complete responses
5. Back to ReadLoop, but leftdata still points to first incomplete buffer
    causing corrupt data to be processed

Solution is to make leftdata nil once we have merged it with the second buffer
2014-08-18 12:35:31 -05:00
Graham Barr
49ea8c0ec1 Increase buffer size to 8K 2014-08-18 09:51:33 -05:00
Graham Barr
3e556edb2d When a job completes, remove its handler 2014-07-24 14:20:56 -05:00
Xing Xing
c8d59ea348 Merge branch 'master' into 0.2-dev 2014-06-13 10:51:48 +08:00
Randall McPherson
0591572d8e Make pool clients safe for concurrent access with mutex. 2014-05-16 10:23:44 -04:00
Xing Xing
5334b50533 fixed #34 2014-03-11 10:03:00 +08:00
Xing Xing
9d7a29fe26 Merge branch 'master' into 0.2-dev 2014-03-07 17:33:16 +08:00
Damian Gryski
7229235a4f Use %v instead of %V, which is not a valid Printf verb 2014-03-07 10:21:45 +01:00
Damian Gryski
ad0d49dcb2 Use fmt.Errorf() instead of errors.New(fmt.Sprintf()) 2014-03-07 10:20:39 +01:00
Xing Xing
f880354a61 type assertion with *net.OpError 2014-03-03 14:45:35 +08:00
Xing Xing
45a9d7c3e5 fixed #31 2014-03-03 11:40:42 +08:00
Xing Xing
98a935207b fixed issue #27 2014-01-15 09:40:36 +08:00
Xing Xing
87631cc2e5 go fmt & better examples 2014-01-09 17:58:02 +08:00
Xing Xing
76196899f8 fxied issue #20 2014-01-09 16:16:34 +08:00
Xing Xing
bf25cc1728 a better documents for the client package 2013-12-26 15:28:42 +08:00
Xing Xing
02e6bfebcb prepared for documentation 2013-12-25 17:01:42 +08:00
Xing Xing
3aa95042e6 merge, client need to refactor 2013-12-24 22:04:10 +08:00
Xing Xing
e9c29799fb refactoring worker side data package 2013-12-20 15:24:22 +08:00
Xing Xing
c8f2f5085c race is bad, how should we do? 2013-09-22 22:58:22 +08:00
Xing Xing
e3f789bc86 fixed nil pointer 2013-09-22 22:02:05 +08:00
Xing Xing
e5179e3b5b started refactoring worker 2013-08-30 18:01:10 +08:00
Xing Xing
124e686699 go fmt 2013-08-30 12:36:57 +08:00
Xing Xing
2a27eca7b7 fixed building package issue 2013-08-30 11:47:53 +08:00
Xing Xing
9daac76f67 removed outside dependency 2013-08-30 11:41:18 +08:00
Xing Xing
764dcf5f99 merge from paulmach 2013-08-30 11:27:41 +08:00
Xing Xing
358c8c4af0 processed ERROR package 2013-08-30 11:20:51 +08:00
Xing Xing
4997e30a77 runabled 0.2 2013-08-29 18:08:05 +08:00
Xing Xing
e5c30068cd 0.2 refactoring begining 2013-08-29 16:51:23 +08:00
Paul Mach
5e215b9257 Remove depenance on external libs for unique id 2013-08-25 22:49:00 -07:00
Xing Xing
2002bb1804 fixed bson/ObjectId 2013-08-07 15:30:41 +08:00