首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >将大文件(约4MB)上载到boa 4MB服务器时出现不可预知的行为

将大文件(约4MB)上载到boa 4MB服务器时出现不可预知的行为
EN

Stack Overflow用户
提问于 2014-03-13 20:19:58
回答 1查看 373关注 0票数 0

我正在为一个嵌入式平台开发一个应用程序,也就是TI的DM385,它运行的是arago。

在通过http上传大于3-4MB的文件时,我遇到了一个奇怪的问题。

有时上传效果很好,有时文件被上传,但数据被破坏,HTTP报头出现在文件的二进制数据中间。

其他时候,我会得到glibc()错误(malloc或free),或者SIGSEGV和boa崩溃。

当使用较小的文件时,如1MB或更小,一切工作正常。我试图通过在整个程序流程中添加大量的调试打印来调试这个问题。这反过来确实减慢了服务器的运行速度,并暂时解决了问题-文件上传每次都工作得很好。

似乎在数据传输过程中使用的一个文件描述符中发生了某种类型的缓冲区欠载,但我真的不能指出任何具体的东西。

有没有人可以分享一些关于这个问题或类似问题的知识?

来自评论的更新:

构建过程中的警告:

代码语言:javascript
运行
复制
boa.c: In function 'main':
boa.c:290: warning: passing argument 4 of 'pthread_create' makes pointer from integer without a cast
boa.c:292: warning: implicit declaration of function 'onvif_dbg'
boa.c: In function 'create_server_socket_udp_hello':
boa.c:376: warning: unused variable 'one'
boa.c: At top level:
boa.c:374: warning: 'create_server_socket_udp_hello' defined but not used
buffer.c: In function 'req_flush':
buffer.c:219: warning: implicit declaration of function 'onvif_dbg'
cgi.c: In function 'uri_decoding':
cgi.c:329: warning: pointer targets in passing argument 1 of 'ascii_to_hex' differ in signedness
config.c: In function 'read_config_files':
config.c:294: warning: implicit declaration of function 'onvif_trace'
request.c: In function 'uri_mpeg4':
request.c:3327: warning: implicit declaration of function 'onvif_dbg'
request.c: In function 'process_requests':
request.c:4730: warning: suggest parentheses around assignment used as truth value
request.c: At top level:
request.c:49: warning: 'sts' defined but not used
In file included from response.c:26:
/home/user/IPNC_RDK/Source/ipnc_rdk/../ipnc_rdk/ipnc_app/interface/inc/system_default.h:16:1: warning: "IPNC_DM385" redefined
<command-line>: warning: this is the location of the previous definition
In file included from select.c:27:
onvif.h:33:12: warning: missing whitespace after the macro name
select.c: In function 'probe_thr':
select.c:46: warning: implicit declaration of function 'GetSysInfo'
select.c:46: warning: initialization makes pointer from integer without a cast
select.c:51: warning: control reaches end of non-void function
select.c: In function 'select_loop':
select.c:66: warning: implicit declaration of function 'pthread_create'
select.c:68: warning: implicit declaration of function 'onvif_dbg'
EN

回答 1

Stack Overflow用户

发布于 2014-03-18 00:58:22

最好的方法是修复所有警告。

然而(注释指的是上面的警告):

代码语言:javascript
运行
复制
boa.c: In function 'main':
boa.c:290: warning: passing argument 4 of 'pthread_create' makes pointer from integer without a cast

检查这个,它可能是致命的。

代码语言:javascript
运行
复制
boa.c:292: warning: implicit declaration of function 'onvif_dbg'

解决这个问题。

代码语言:javascript
运行
复制
boa.c: In function 'create_server_socket_udp_hello':
boa.c:376: warning: unused variable 'one'

不是很好,但却是无害的。

代码语言:javascript
运行
复制
boa.c: At top level:
boa.c:374: warning: 'create_server_socket_udp_hello' defined but not used

不是很好,但却是无害的。

代码语言:javascript
运行
复制
buffer.c: In function 'req_flush':
buffer.c:219: warning: implicit declaration of function 'onvif_dbg'

解决这个问题。

代码语言:javascript
运行
复制
cgi.c: In function 'uri_decoding':
cgi.c:329: warning: pointer targets in passing argument 1 of 'ascii_to_hex' differ in signedness

检查这个,它可能是致命的。

代码语言:javascript
运行
复制
config.c: In function 'read_config_files':
config.c:294: warning: implicit declaration of function 'onvif_trace'

解决这个问题。

代码语言:javascript
运行
复制
request.c: In function 'uri_mpeg4':
request.c:3327: warning: implicit declaration of function 'onvif_dbg'

解决这个问题。

代码语言:javascript
运行
复制
request.c: In function 'process_requests':
request.c:4730: warning: suggest parentheses around assignment used as truth value

检查这个,它可能是致命的。

代码语言:javascript
运行
复制
request.c: At top level:
request.c:49: warning: 'sts' defined but not used

不是很好,但却是无害的。

代码语言:javascript
运行
复制
In file included from response.c:26:
/home/user/IPNC_RDK/Source/ipnc_rdk/../ipnc_rdk/ipnc_app/interface/inc/system_default.h:16:1: warning: "IPNC_DM385" redefined
<command-line>: warning: this is the location of the previous definition
In file included from select.c:27:

检查这个,它可能是致命的。

代码语言:javascript
运行
复制
onvif.h:33:12: warning: missing whitespace after the macro name

检查这个,它可能是致命的。

代码语言:javascript
运行
复制
select.c: In function 'probe_thr':
select.c:46: warning: implicit declaration of function 'GetSysInfo'

解决这个问题。

代码语言:javascript
运行
复制
select.c:46: warning: initialization makes pointer from integer without a cast

解决这个问题。

代码语言:javascript
运行
复制
select.c:51: warning: control reaches end of non-void function

解决这个问题。

代码语言:javascript
运行
复制
select.c: In function 'select_loop':
select.c:66: warning: implicit declaration of function 'pthread_create'

解决这个问题。

代码语言:javascript
运行
复制
select.c:68: warning: implicit declaration of function 'onvif_dbg'

解决这个问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22378462

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档