我写了一个程序,但是访问一会,就会把apache卡死,只有重起才会好。

xiachao2008 2012-06-25 10:53:59
我想问问,这个是什么原因引起的哟?
我怎么调试呢,找出问题呢?
...全文
568 27 打赏 收藏 转发到动态 举报
写回复
用AI写文章
27 条回复
切换为时间正序
请发表友善的回复…
发表回复
码无边 2012-06-26
  • 打赏
  • 举报
回复
无源码,无真相
Kogeo_Guan 2012-06-26
  • 打赏
  • 举报
回复
...... 喜欢唠叨老大的比喻。。 但是现在是apache 的错还是 程序的错呢 , 好像 还没找到问题
xuzuning 2012-06-26
  • 打赏
  • 举报
回复
至少需要这样:
设一全局变量 ok 令
ok = 1;
.....
if( s <= 1.5 && times < 3 && ok) {
ok = 0;
$.getJSON(getDataUrl,{start:start,end:end,id:typeId},function(e){
scrollData = e;
...
scrollData='';
ok = 1;
}

其意义在于:当ajax数据没有返回时,不进行下一轮请求
xiachao2008 2012-06-26
  • 打赏
  • 举报
回复



this.getPages = function(getDataUrl,page,typeId){
var times=0;
$(document).ready(function(){
$(window).scroll(function() {
var start = page*80+(20*times),
end = 20,
h = document.body.offsetHeight,
t = $(document).scrollTop(),
s = h/t;
if( s <= 1.5 && times < 3) {
$.getJSON(getDataUrl,{start:start,end:end,id:typeId},function(e){
scrollData = e;
var size = scrollData.length;
for(var i =0 ;i< size; i++){
if(i<=4){
$("#list_01_01").append(scrollData[i]);
}else if(i<=9){
$("#list_01_02").append(scrollData[i]);
} else if(i<=14){
$("#list_01_03").append(scrollData[i]);
} else if(i<=19){
$("#list_01_04").append(scrollData[i]);
}
}
scrollData='';
})
times++;
a++;
}
if(times == 3){
$("#page_select").css('display','block');
exit();
}
})
})
}


[Quote=引用 24 楼 的回复:]

无源码,无真相
[/Quote]

我到现在为止,处理我上面无会无限发请求,还是不知道怎么解决?
xiachao2008 2012-06-25
  • 打赏
  • 举报
回复
总之,今天主管来看我做得怎么样了,程序被卡到那动不了,好悲剧。。。[Quote=引用 13 楼 的回复:]

http://125.86.30.154:8081/goods/tuangou_t0_a154_p0.html

就是这个网站,多在页面里操作切换几次,我的apache就会死掉。

对了,

这个里面的分类,我是用的上一次我在论坛进里面问的方法。
http://topic.csdn.net/u/20120528/18/2255b303-9aa6-487e-974a-68627856……
[/Quote]
xiachao2008 2012-06-25
  • 打赏
  • 举报
回复
http://125.86.30.154:8081/goods/tuangou_t0_a154_p0.html

就是这个网站,多在页面里操作切换几次,我的apache就会死掉。

对了,

这个里面的分类,我是用的上一次我在论坛进里面问的方法。
http://topic.csdn.net/u/20120528/18/2255b303-9aa6-487e-974a-686278564e74.html


商品表里有6十万数据,
团购表里有1千3百万数据。

好像是在团购表里城市多切换几下,就会被卡做。
也好像是在商品表里向下拉 要卡一会,在加载进来,(程序一下发了三个请求,这个地方我也要修改)也会卡一下。

这个是我感觉观察到的,

对了,这个里面的查询数据我都用了“like” 后面加了%
就比如说 查询衣服 t_id like "10%" 也不知道,是不是用了like的原因,但是我在数据库看了,查询时间还是挺快的嘛?

[Quote=引用 12 楼 的回复:]

你就这么问,让你家如何帮你?

如果我问你:我早上摔了一跤,是什么原因?
你该如何回答?
[/Quote]
xuzuning 2012-06-25
  • 打赏
  • 举报
回复
你就这么问,让你家如何帮你?

如果我问你:我早上摔了一跤,是什么原因?
你该如何回答?
xiachao2008 2012-06-25
  • 打赏
  • 举报
回复
关闭浏览器 打开以前的网址,还是卡起的,打不开网站,
重起一apache,就又可以打开网站了。
[Quote=引用 8 楼 的回复:]

卡死apache 还是卡死浏览器? 还是两个都卡死了?多半都是程序没写好 死循环.

访问了一会卡死那多半是js.要么你访问后关闭浏览器 看看你apache还死不死...
[/Quote]
xiachao2008 2012-06-25
  • 打赏
  • 举报
回复
access 是空的,什么内容都没有
[Quote=引用 9 楼 的回复:]

引用 7 楼 的回复:

是这个嘛?

HTML code

[Sun May 13 13:01:14 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sun May 13 13:01:14 2012] [notice] Apache/2.2.22 (Win32) mod_ss……
[/Quote]
qq120848369 2012-06-25
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 的回复:]

是这个嘛?

HTML code

[Sun May 13 13:01:14 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sun May 13 13:01:14 2012] [notice] Apache/2.2.22 (Win32) mod_ssl/2.2.22 OpenSSL/0……
[/Quote]

access和error,
黄袍披身 2012-06-25
  • 打赏
  • 举报
回复
卡死apache 还是卡死浏览器? 还是两个都卡死了?多半都是程序没写好 死循环.

访问了一会卡死那多半是js.要么你访问后关闭浏览器 看看你apache还死不死...
xiachao2008 2012-06-25
  • 打赏
  • 举报
回复
是这个嘛?


[Sun May 13 13:01:14 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sun May 13 13:01:14 2012] [notice] Apache/2.2.22 (Win32) mod_ssl/2.2.22 OpenSSL/0.9.8x configured -- resuming normal operations
[Sun May 13 13:01:14 2012] [notice] Server built: May 13 2012 12:51:11
[Sun May 13 13:01:14 2012] [notice] Parent: Created child process 3660
Apache server interrupted...
arn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sun May 13 13:01:15 2012] [notice] Child 3660: Child process is running
[Sun May 13 13:01:15 2012] [notice] Child 3660: Acquired the start mutex.
[Sun May 13 13:01:15 2012] [notice] Child 3660: Starting 64 worker threads.
[Sun May 13 13:01:15 2012] [notice] Child 3660: Starting thread to listen on port 80.
[Sun May 13 13:01:15 2012] [notice] Child 3660: Starting thread to listen on port 80.
[Sun May 13 13:01:28 2012] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Sun May 13 13:01:28 2012] [notice] Child 3660: Exit event signaled. Child process is ending.
[Sun May 13 13:01:29 2012] [notice] Child 3660: Released the start mutex
[Sun May 13 13:01:30 2012] [notice] Child 3660: All worker threads have exited.
[Sun May 13 13:01:30 2012] [notice] Child 3660: Child process is exiting
[Sun May 13 13:01:30 2012] [notice] Parent: Child process exited successfully.

[Quote=引用 4 楼 的回复:]

先贴apache日志。
[/Quote]
franzhong 2012-06-25
  • 打赏
  • 举报
回复
你打开一个确可正确的页面,停留等他卡死,若是再卡死,是apache问题,与程序无关
我以前也卡过,多数是程序问题,也有可能是浏览器卡住了
看Log是比较直接的方法
蹲坑看月亮 2012-06-25
  • 打赏
  • 举报
回复
怎么可能是死循环呢,要是死循环卡的是你的页面,关apache毛事呀~~
apache卡死是神马个情况? 求解~~
你那个错误日志能找出来瞄哈不~~求解
qq120848369 2012-06-25
  • 打赏
  • 举报
回复
先贴apache日志。
xiachao2008 2012-06-25
  • 打赏
  • 举报
回复
没有,是访问了一会,才卡死的。
[Quote=引用 1 楼 的回复:]

发源代码来看看 是不是死循环了
[/Quote]
一起混吧 2012-06-25
  • 打赏
  • 举报
回复
死循环了?
weibozhuce3 2012-06-25
  • 打赏
  • 举报
回复
发源代码来看看 是不是死循环了
xuzuning 2012-06-25
  • 打赏
  • 举报
回复
你需要注意到的是:
加载是由滚动条到达某一位置后开始的
你无法要求用户在加载开始后不再去拉动滚动条

你的加载请求是在 页面高/滚动条顶 < 1.5 发出的
只要是继续向下拉滚动条,则条件始终是满足的。请求将不断发出

这个与当初的讨论是不完全相同的
在那个问题中,滚动条顶部到达控制点时发出请求。只要没有收到返回的数据,这个控制点的位置时不会变化的,所以继续向下拉动滚动条并不会触发请求
xiachao2008 2012-06-25
  • 打赏
  • 举报
回复
times < 3
就是发一次请求
times++

加载三次就显示分页,我是为了做这样的功能的。

如果是由滚动条事件触发的,times 表示一个时间间隔。
那么 times 应大于某个时间间隔时才行

你的意思是,我在请求一次的时候,还记录一下请求时间,如果时间小于一定时间就,不加载?
[Quote=引用 20 楼 的回复:]

加载请求是由谁触发的?
times < 3
times 是什么?

如果是由滚动条事件触发的,times 表示一个时间间隔。
那么 times 应大于某个时间间隔时才行
[/Quote]
加载更多回复(7)

21,882

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧