Comments (5)
see #64 (comment).
后续我处理下
from flare.
应该已经修复了,感谢反馈。
from flare.
from flare.
不过这个解决不了别的代码里用errno导致的问题 Luo Bo @.***> 于2022年5月30日周一 00:15写道:
…
解决不了,但是其实应该也不涉及到这个问题。
出问题的原因是访问errno
展开成了*errno_location()
,然后这个errno_location()
返回的地址是一个线程局部变量,只有在:
- 一个函数(不考虑LTO、inline)访问了两次
errno
; - 编译器在第一次访问的时候把
errno_location()
返回值缓存在了寄存器里; - 两次访问之间出现了fiber调度(导致寄存器里面缓存的tls地址失效)。
的情况下,才会出问题。
这儿有两种情况:
- 完全的第三方库代码,整个不涉及fiber:不满足上面第三点,不会出问题;
- 基于flare的业务代码:这种代码业务可控,可以直接用
fiber::GetLastError()
解决。
这个解决方案其实我理解不会显得突兀——我们实际上已经有了其他的fiber环境下的“替代品”,比如fiber::Mutex
。这儿的fiber::GetLastError()
也属于类似的设计思路,这种解决方案某种角度来说还有点显得比较整体化。
另外说句题外话,根据上面的分析能看出来,解决这个问题实际上需要在访问errno
的目标上处理__const__
,对于我们内部来说实际上也就是需要修改BLADE_ROOT
。不过内部其实一直没加过-D__const__=
,也没人报过问题,所以其实真实的影响面看起来也挺小的。
from flare.
为了方便向业务同学解释,这个思路可以简单的表述为,“不涉及fiber的逻辑(函数、类、被测单元等等)不需要考虑fiber;依赖fiber的逻辑,使用fiber相关的替代品”。
通常来说,一个系统除了rpc之外,还有大量的框架无关的子系统(比如整个检索引擎)。此时允许这些fiber无关的代码独立在flare之外进行开发、测试(即避免flare侵入这些模块),对于整套系统的模块化是非常重要的。
这种“不用fiber不考虑fiber、用的话需要按照fiber的要求编码”也有点c++的“what you don’t use, you don’t pay for”的那个味道。
from flare.
Related Issues (20)
- Http header data structure HOT 13
- Rpc: Http parse HOT 5
- 针对K8s容器环境是否有需要注意的优化配置呢 HOT 2
- clang-format HOT 15
- update blade HOT 9
- logging HOT 11
- if have any plan to support bazel HOT 1
- bazel build ... 失败 HOT 6
- 请问有合适的源码阅读顺序吗 HOT 5
- 对GetFreeCount的取值比较困惑 HOT 5
- Does the server example in the flare example support 1 thread start? HOT 4
- clang-17 asan/tsan fiber coredump
- 关于Function类的疑问 HOT 2
- 问一个非常诡异的用例 HOT 10
- About scheduler_lock HOT 11
- About unboxed_type_t HOT 2
- coredump when http overloaded HOT 2
- Timer HOT 6
- 为什么侵入式的链表采用的是组合而不是继承? HOT 5
- 使用`getaddrinfo`会不会更好一点 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flare.