我正在运行带有socket.io的Express js应用程序用于聊天webapp,并且我在24小时内随机获得以下错误5次左右.节点进程永远包装,并立即重新启动.
问题是重新启动快速将我的用户踢出他们的房间而没人想要.
Web服务器由HAProxy代理.没有套接字稳定性问题,只使用websockets和flashsockets传输.我无法故意重现这一点.
这是节点v0.10.11的错误:
events.js:72
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET //alternatively it s a 'write'
at errnoException (net.js:900:11)
at TCP.onread (net.js:555:19)
error: Forever detected script exited with code: 8
error: Forever restarting script for 2 time
Run Code Online (Sandbox Code Playgroud)
编辑(2013-07-22)
添加了socket.io客户端错误处理程序和未捕获的异常处理程序.似乎这个捕获了错误:
process.on('uncaughtException', function (err) {
console.error(err.stack);
console.log("Node NOT Exiting...");
});
Run Code Online (Sandbox Code Playgroud)
所以我怀疑它不是socket.io问题,而是对我做的另一个服务器的http请求或mysql/redis连接.问题是错误堆栈无法帮助我识别代码问题.这是日志输出:
Error: read ECONNRESET
at errnoException (net.js:900:11)
at TCP.onread (net.js:555:19)
Run Code Online (Sandbox Code Playgroud)
我怎么知道是什么原因造成的?如何从错误中获得更多信息?
好吧,不是很冗长,但这里是带有"longjohn"的堆栈跟踪:
Exception caught: Error ECONNRESET
{ [Error: read ECONNRESET]
code: 'ECONNRESET',
errno: 'ECONNRESET',
syscall: 'read',
__cached_trace__: …Run Code Online (Sandbox Code Playgroud) 使用2个参数执行POST请求时:
return $this->perform($client->post("/authenticate",null, array(
"username" => 'radupass',
"password" => '@alcool', //starting with an @
)));
Run Code Online (Sandbox Code Playgroud)
哪里$客户:
/**
* @return \Guzzle\Service\Client
*/
public function getClient()
{
if ($this->_client === null) {
$this->_client = new Guzzle\Service\Client($this->baseUrl, $this->_options);
$this->_client->setDefaultHeaders(array(
"X-WebsiteId" => $this->websiteId,
"X-AccessToken" => $this->accessToken,
));
}
return $this->_client;
}
Run Code Online (Sandbox Code Playgroud)
我得到以下异常:
2013/05/29 11:08:29 [error] [exception.Guzzle\Common\Exception\InvalidArgumentException] exception 'Guzzle\Common\Exception\InvalidArgumentException' with message 'Unable to open lcool for reading' in /home/xxx/site/vendor/guzzle/guzzle/src/Guzzle/Http/Message/PostFile.php:58
Stack trace:
#0 /home/xxx/site/vendor/guzzle/guzzle/src/Guzzle/Http/Message/PostFile.php(25): Guzzle\Http\Message\PostFile->setFilename('@lcool')
#1 /home/xxx/site/vendor/guzzle/guzzle/src/Guzzle/Http/Message/EntityEnclosingRequest.php(245): Guzzle\Http\Message\PostFile->__construct('password', '@lcool', NULL)
#2 /home/xxx/site/vendor/guzzle/guzzle/src/Guzzle/Http/Message/EntityEnclosingRequest.php(273): Guzzle\Http\Message\EntityEnclosingRequest->addPostFile('password', '@lcool', NULL, false) …Run Code Online (Sandbox Code Playgroud) 我有以下表格:
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
'id'=>'new-agenda-entry',
'enableAjaxValidation'=>true,
'action'=>'')); ?>
<div class="four columns">
<div class="right top5 sufix10">
<?php echo $form->labelEx($model,'eventTime'); ?>
<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
'name'=>'UserAgenda[eventTime]',
'model'=>$model,
'options'=>array(
'dateFormat'=>'yy-mm-dd',
'minDate'=>'new Date()',
) // jquery plugin options
));?>
<?php echo $form->error($model, 'eventTime'); ?>
</div>
<div class="right top5 sufix10">
<?php echo CHtml::dropdownList('eventTime_hour', false, $this->getHourArray()); ?>
<?php echo CHtml::dropdownList('eventTime_min', false, array('00'=>'00', '30'=>'30')); ?>
</div>
<?php echo $form->labelEx($model,'note'); ?>
<?php echo $form->textField($model, 'note');?>
<?php echo $form->error($model, 'note'); ?>
Run Code Online (Sandbox Code Playgroud)
该模型在服务器上成功验证,因为我可以在Firebug中看到响应:
{"UserAgenda_eventTime":["Event time cannot be blank."],"UserAgenda_note":["Note cannot be …Run Code Online (Sandbox Code Playgroud) 我想使用base64在我的数据库中保存上传的照片,但我无法获取数据:
形成:
<?php $form=$this->beginWidget('CActiveForm',
array(
'id' => 'upload-form',
'enableAjaxValidation' => false,
'htmlOptions' => array('enctype' => 'multipart/form-data'),
));?>
<?php echo $form->fileField($model, 'attachment');?>
Run Code Online (Sandbox Code Playgroud)
控制器:
$model->attributes=$_POST['Post'];
//gives me the filename
$model->attachment=CUploadedFile::getInstance($model,'attachment');
Run Code Online (Sandbox Code Playgroud)
如何获取内容以便我可以编码?
我在UserBan模型中定义了以下关系:
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'user' => array(self::BELONGS_TO, 'User', 'userId'),
'target' => array(self::BELONGS_TO, 'User', 'targetId'),
'author' => array(self::BELONGS_TO, 'User', 'authorId'),
);
}
Run Code Online (Sandbox Code Playgroud)
现在,当我尝试做:
$criteria->with = array('user', 'target');
Run Code Online (Sandbox Code Playgroud)
它会尖叫以下内容,因为User mdel与Nicknames有默认的范围关系:
Not unique table/alias: 'nicknames'
Run Code Online (Sandbox Code Playgroud)
SQL:
SELECT COUNT(DISTINCT `t`.`id`) FROM `userban` `t`
LEFT OUTER JOIN `user` `user` ON (`t`.`userId`=`user`.`id`)
LEFT OUTER JOIN `nickname` `nicknames` ON (`nicknames`.`userId`=`user`.`id`) …Run Code Online (Sandbox Code Playgroud) 任何人都可以了解Youtube Gaming用于实现疯狂帧率的直播流媒体堆栈吗?(60fps的)
在我看来像HLS,但更好.每隔约3秒接收一块二进制数据,一个块约为200kb.
PS:我使用https://github.com/phoboslab/jsmpeg通过HTTP实现实时流式传输- 通过websockets将二进制数据发送到浏览器.虽然它可以跨厂商工作并达到~20fps,但它远不及声音.
我可以在SQL LOADER中执行类似的操作吗?
LOAD DATA
INFILE 'table_with_one_million_rows.dat'
INTO TABLE TABLE_WITH_ONE_MILLION_ROWS
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(
COL1 DECIMAL
, COL2 DECIMAL IF COL1='X' '1' else '0'
, COL3 CHAR
)
Run Code Online (Sandbox Code Playgroud) 我想在Codeigniter中使用包含常量的新文件,因此我创建了该文件 /config/labels.php
当我尝试在我的控制器中加载它时$this->config->load('labels');它会抛出它
application/config/labels.php file does not appear to contain a valid configuration array.
但是,当我将代码放在constants.php文件中时,一切都运行良好.
labels.php
<?php
define('CLI_CIVILITE','Civilité');
define('CLI_NOM','Nom');
define('CLI_PRENOM','Prenom');
Run Code Online (Sandbox Code Playgroud) 是否可以使用select过滤一些要在表上合并的条目?
MERGE INTO (
SELECT * FROM P4PCA2_PIVOT_CA
WHERE ( CA_LIG_VTE_NUM_ID_PDT <> 0 )
) ta
USING P4DAS2_DONARTSTK tb ON (tb.NUM_ID_PDT =ta.CA_LIG_VTE_NUM_ID_PDT)
WHEN MATCHED THEN
UPDATE SET ta.COD_SECVTE_REVENT=tb.COD_SECVTE_REVENT);
Run Code Online (Sandbox Code Playgroud) 我已成功安装节点模块"摩卡phantomjs" 在这里.我写了以下测试用例:
test1.js
describe("DOM Tests", function () {
var el = document.createElement("div");
el.id = "myDiv";
el.innerHTML = "Hi there!";
el.style.background = "#ccc";
document.body.appendChild(el);
var myEl = document.getElementById('myDiv');
it("is in the DOM", function () {
expect(myEl).to.equal(null);
});
it("is a child of the body", function () {
expect(myEl.parentElement).to.equal(document.body);
});
it("has the right text", function () {
expect(myEl.innerHTML).to.equal("Hi there!");
});
it("has the right background", function () {
expect(myEl.style.background).to.equal("rgb(204, 204, 204)");
});
});
Run Code Online (Sandbox Code Playgroud)
TestCase.html
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="mocha.css" />
</head> …Run Code Online (Sandbox Code Playgroud)