不常见错误记录贴
yii2 Expected array for frame 0
网上查询到的资料是说是xdebug,并且出现在php 7上。我在服务器上验证过确实如此,原因没找到,只能置之不理。
linux 执行shell报bad interpreter:No such file or directory错误
vim 输入:,执行 set ff ,修改文件类型
连接池池异常 (has already been bound to another coroutine#3, reading of the same socket in coroutine#2 at the same time is not allowed in)
本错误是发生在 hyperf 框架使用协程,将 mysql 查询对象传入协程中,与主进程同时并发的使用了该类。
如何避免?
使用闭包函数(Closure),传入一个创建 db查询构造器的方法。这样协程与主进程就能从连接池获取不同的 mysql 连接。从而避免报错。
$func = function () use (...){
return new Db();
};
// master 进程
$query = $func();
go(function() use($func) {
$query = $func();
// do ...
});
分布式使用事务问题
项目A启用事务,并不提交.
项目B修改A事务中修改的记录,会导致报错.
需要正确的使用分布式事务
分布式事务的解决方案