Giter VIP home page Giter VIP logo

Comments (6)

panjf2000 avatar panjf2000 commented on May 23, 2024

怎么你们提 issue 都不按 template 填的?不要删掉 template 内容自己填啊!这样缺少很多必要信息,

  1. 什么操作系统?
  2. Go 是哪个版本?
  3. gnet 是哪个版本?

还有,麻烦贴下完整代码,不然不太好具体分析。

from gnet.

luyu6056 avatar luyu6056 commented on May 23, 2024

不好意思,这个是我疏忽了,我点提交issue 要求登录,登陆完返回的界面并没有template 的内容,是空的。
1.是wsl2 的ubuntu18.04
2.go 是1.13.1和1.13.3
3.版本是v1.0.0-beta.6
你那边想了解我go的项目代码,还是pprof打印的内容?

from gnet.

panjf2000 avatar panjf2000 commented on May 23, 2024

@luyu6056
代码和 pprof 输出都贴一下吧,要是不太方便发在 issue 里的话发我邮箱也行:[email protected],
我现在看你描述现象,我的一个猜测是 eventfd 的写入数达到最大值了, 如 man 手册说的那样:

  write(2)
              A write(2) call adds the 8-byte integer value supplied in its
              buffer to the counter.  The maximum value that may be stored
              in the counter is the largest unsigned 64-bit value minus 1
              (i.e., 0xfffffffffffffffe).  If the addition would cause the
              counter's value to exceed the maximum, then the write(2)
              either blocks until a read(2) is performed on the file
              descriptor, or fails with the error EAGAIN if the file
              descriptor has been made nonblocking.

              A write(2) fails with the error EINVAL if the size of the
              supplied buffer is less than 8 bytes, or if an attempt is made
              to write the value 0xffffffffffffffff.

你代码里是不是大量调用 AsyncWrite ?导致把 eventfd 塞满了所以阻塞,不过它的最大值是很大的,正常来说不会触到最大值的,所以还是看下具体代码我再仔细分析下。

from gnet.

luyu6056 avatar luyu6056 commented on May 23, 2024

好消息是,我调用了goroutine去处理消息回调AsyncWrite,完成了连续1000个消息接发请求,我建议在代码上对AsyncWrite进行goroutine异步处理,等晚上回家我把问题代码发到你邮箱

from gnet.

panjf2000 avatar panjf2000 commented on May 23, 2024

@luyu6056
额。。。 AsyncWrite 方法本来就是设计来放到 goroutine 异步写的,README 也有相关说明:带阻塞逻辑的 Server,不过理论上就算是直接调用 AsyncWrite 也不应该会阻塞,所以先看看代码吧,我确认下是 bug 还是你的写法问题。

from gnet.

panjf2000 avatar panjf2000 commented on May 23, 2024

BTY, 温馨提示 v1.0.0-beta.7 已经 released 了,做了一些小优化,可以升级到这个版本😀

from gnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.