panic: interface conversion: interface {} is nil, not chan *sarama.ProducerError
使用golang kafka sarama 包时,遇到如下问题:
高并发情况下使用同步sync producer,偶尔遇到crash:
panic: interface conversion: interface {} is nil, not chan *sarama.ProducerError
goroutine 413 [running]:
github.com/Shopify/sarama.(*syncProducer).handleSuccesses(0xc420384840)
/home/lanyang/github.com/Shopify/sarama/sync_producer.go:147 +0x139
github.com/Shopify/sarama.handleSuccesses)-fm()
/home/lanyang/src/github.com/Shopify/sarama/sync_producer.go:76 +0x2f
github.com/Shopify/sarama.withRecover(0xc4201d0750)
/home/lanyang/src/github.com/Shopify/sarama/utils.go:43 +0x45
created by github.com/Shopify/sarama.newSyncProducerFromAsyncProducer
/home/lanyang/src/github.com/Shopify/sarama/sync_producer.go:76 +0x112
问题不容易复现,github上已经留言:
https://github.com/Shopify/sarama/issues/785
download
https://github.com/Shopify/sarama
https://shopify.github.io/sarama/
doc
https://godoc.org/github.com/Shopify/sarama
依赖
github.com/davecgh/go-spew
github.com/eapache/go-resiliency
github.com/eapache/go-xerial-snappy
github.com/eapache/queue
github.com/pierrec/lz4
github.com/pierrec/xxHash
github.com/rcrowley/go-metrics
github.com/golang/snappy
如果kafka down掉,又恢复,client 可自动连接上。
异步方式,网络断开后,仍然会从queue,放入producer的channel中,重连后,这些内容丢失。
例子参考
sync
http://legendtkl.com/2016/06/30/kafka-in-action/
https://studygolang.com/articles/7102
async
https://studygolang.com/articles/11199
panic: interface conversion: interface {} is nil, not chan *sarama.ProducerError的更多相关文章
- go中interface空指针不为nil判断方法
interface空指针不为nil 当把一个空指针对象赋值给一个interface后,再判断!= nil就不再成立了 代码如下 package main import "fmt" ...
- 【Go入门教程6】interface(interface类型、interface值、空interface{}、嵌入interface、反射)
interface Go语言里面设计最精妙的应该算interface,它让面向对象,内容组织实现非常的方便,当你看完这一章,你就会被interface的巧妙设计所折服. 什么是interface 简单 ...
- 【Go入门教程8】interface(interface类型、interface值、空interface{}、嵌入interface、反射)
interface Go语言里面设计最精妙的应该算interface,它让面向对象,内容组织实现非常的方便,当你看完这一章,你就会被interface的巧妙设计所折服. 什么是interface 简单 ...
- golang interface判断为空nil
要判断interface 空的问题,首先看下其底层实现. interface 底层结构 根据 interface 是否包含有 method,底层实现上用两种 struct 来表示:iface 和 ef ...
- panic: reflect.Value.Interface: cannot return value obtained from unexported field or method
go的结构体中私有的属性, 即使反射也获取不到
- Libsvm:脚本(subset.py、grid.py、checkdata.py) | MATLAB/OCTAVE interface | Python interface
1.脚本 This directory includes some useful codes: 1. subset selection tools. (子集抽取工具) subset.py 2. par ...
- Unity Interface Serialization-Expose Interface field In Inspector
Unity has some quirks about their inspector, so as a preface they are listed here: If you add a [Ser ...
- Java abstract interface与 interface的区别
我们常常遇到abstract class与 interface的区别,今天却遇到了abstract interface,感觉interface不用abstract再修饰了啊.结论:事实也确实如此,编译 ...
- 深度解密Go语言之关于 interface 的10个问题
目录 1. Go 语言与鸭子类型的关系 2. 值接收者和指针接收者的区别 方法 值接收者和指针接收者 两者分别在何时使用 3. iface 和 eface 的区别是什么 4. 接口的动态类型和动态值 ...
随机推荐
- CryptoTools加密与解密
CryptoTools加密与解密 java常用的加密算法有MD5(Message Digest algorithm 5,信息摘要算法) BASE64(严格地说,属于编码格式,而非加密算法) SHA(S ...
- Centos7环境下使用Nginx托管.Net Core应用程序
一.安装.Net Core 参考官方文档:https://www.microsoft.com/net/core#linuxcentos 1.添加dotnet产品Feed 在安装.NET Core之前, ...
- 51nod 1118 机器人走方格 解题思路:动态规划 & 1119 机器人走方格 V2 解题思路:根据杨辉三角转化问题为组合数和求逆元问题
51nod 1118 机器人走方格: 思路:这是一道简单题,很容易就看出用动态规划扫一遍就可以得到结果, 时间复杂度O(m*n).运算量1000*1000 = 1000000,很明显不会超时. 递推式 ...
- Linux crontab任务调度
一.crontab说明 Linux crontab任务调度是在规定的时间频率内去执行相应的任务. 二.crontab文件详情 1.crontab文件在Linux中的/etc/crontab 2.查看c ...
- 线段树专题—ZOJ1610 Count the Colors(涂区间,直接tag标记)
Painting some colored segments on a line, some previously painted segments may be covered by some th ...
- windows下怎么解决Python双版本问题
相信大家会在windows下会遇到Python双版本问题 当我们装了Python2和Python3时我们好只能在命令栏调出最高版本的那个低版本的难道消失了吗?今天我们就解决这个问题! 1.下载 我们在 ...
- 正确使用Exception异常对象
一.异常的构成 new Exception() 创建异常对象 throw 抛出异常对象(主要性能损耗位置) try{}catch{} 捕捉异常对象 C#里面异常对象分为两个子类ApplicationE ...
- MVC中@RenderBody、@RenderSection、@RenderPage、@Html.RenderPartial、Html.RenderAction的作用和区别
1.@RenderBody() 作用和母版页中的服务器控件类似,当创建基于此布局页面的视图时,视图的内容会和布局页面合并,而新创建视图的内容会通过布局页面的@RenderBody()方法呈现在标签 ...
- Jquery仿京东分类导航层简单实现
<script src="/js/jquery-1.11.1.min.js" type="text/javascript"></script& ...
- jquery系列教程6-ajax的应用全解
点击打开: jquery系列教程1-选择器全解 jquery系列教程2-style样式操作全解 jquery系列教程3-DOM操作全解 jquery系列教程4-事件操作全解 jquery系列教程5-动 ...