nginx下使用asan和valgrind两个静态检查工具
wegit:http://valgrind.org/downloads/valgrind-3.12.0.tar.bz2
tar -jxvf valgrind-3.12.0.tar.bz2
cd valgrind-3.12.0
./configure
make
sudo make install
输入valgrind–h显示valgrind的参数及提示,说明安装成功
sudo valgrind --tool=memcheck --leak-check=full /usr/local/nginx-1.4.2/sbin/nginx
==41400== Memcheck, a memory error detector
==41400== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==41400== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==41400== Command: /usr/local/nginx-1.4.2/sbin/nginx
==41400==
==41400== Warning: set address range perms: large range [0x957a040, 0x2e45f7e2) (undefined)
==41400== Warning: set address range perms: large range [0x957b040, 0x2e45f040) (defined)
nginx: [error] failed to initialize Lua VM in /usr/local/nginx-1.4.2/conf/nginx.conf:125
==41400==
==41400== HEAP SUMMARY:
==41400== in use at exit: 619,703,912 bytes in 3,285 blocks
==41400== total heap usage: 20,476 allocs, 17,191 frees, 626,783,730 bytes allocated
==41400==
==41400== 128 bytes in 1 blocks are possibly lost in loss record 583 of 650
==41400== at 0x4C2ABA0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==41400== by 0x431D0A: ngx_alloc (ngx_alloc.c:22)
==41400== by 0x4222CE: ngx_crc32_table_init (ngx_crc32.c:117)
==41400== by 0x41A20B: main (nginx.c:320)
==41400==
==41400== 1,024 bytes in 1 blocks are definitely lost in loss record 626 of 650
==41400== at 0x4C2D136: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==41400== by 0x4C2D251: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==41400== by 0x431DBB: ngx_memalign (ngx_alloc.c:57)
==41400== by 0x41B5C2: ngx_create_pool (ngx_palloc.c:21)
==41400== by 0x419F52: main (nginx.c:299)
==41400==
==41400== LEAK SUMMARY:
==41400== definitely lost: 1,024 bytes in 1 blocks
==41400== indirectly lost: 0 bytes in 0 blocks
==41400== possibly lost: 128 bytes in 1 blocks
==41400== still reachable: 619,702,760 bytes in 3,283 blocks
==41400== suppressed: 0 bytes in 0 blocks
==41400== Reachable blocks (those to which a pointer was found) are not shown.
==41400== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==41400==
==41400== For counts of detected and suppressed errors, rerun with: -v
==41400== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
解决的办法是使用 openresty 的 luajit 仓库的 v2.1-agentzh 分支重新: https://github.com/openresty/luajit2/tree/v2.1-agentzh ,然后,重新编译一个特殊版本的 LuaJIT,强制它使用系统的分配器,即在编译 LuaJIT 时使用类似下面的命令: make CCDEBUG=-g Q= XCFLAGS='-DLUAJIT_USE_VALGRIND -DLUAJIT_USE_SYSMALLOC'
worker_processes 1;
daemon off;
master_process off;
或者使用在valgrind中使用–trace-children=yes 选项跟踪子进程信息
--fsanitize=address -fno-omit-frame-pointer -static-libasan
--with-ld-opt="-fsanitize=address -static-libasan"
modified: libs/protobuf/Makefile
modified: src/core/nginx.h
modified: src/core/ngx_array.c
modified: src/core/ngx_array.h
modified: src/core/ngx_palloc.c
modified: src/core/ngx_palloc.h
nginx下使用asan和valgrind两个静态检查工具的更多相关文章
- C++ 两款静态检查工具
pclint(收费) http://www.gimpel.com/html/pcl.htmpc-lint是资格最老,最强力的代码检查工具,但是是收费软件,并且配置起来有一点点麻烦. ccpchecke ...
- 安全防范:nginx下git引发的隐私泄露问题
安全防范:nginx下git引发的隐私泄露问题 1 安全事件 最近阿里云服务器后台管理系统中收到一条安全提示消息,系统配置信息泄露: http://my.domain.com/.git/confi ...
- nginx下目录浏览及其验证功能配置记录
工作中常常有写不能有网页下载东西的需求,在Apache下搭建完成后直接导入文件即可达到下载/显示文件的效果;而Nginx的目录列表功能默认是关闭的,如果需要打开Nginx的目录列表功能,需要手动配置, ...
- Nginx下配置ThinkPHP的URL Rewrite模式和pathinfo模式支持
前面有关于lnmp环境的搭建,在此就不在赘述.下面就简述thinkPHP如何在nginx下开启url_rewrite和pathinfo模式支持 主要有两个步骤: 一.更改php.ini将;cgi.fi ...
- CentOS 下用的是lnmp 的包配置Nginx 下的CI伪静态(搞爽了)
server { listen ; server_name cy.com; index index.html index.htm index.php default.html default.htm ...
- 新秀nginx源代码分析数据结构篇(两) 双链表ngx_queue_t
nginx源代码分析数据结构篇(两) 双链表ngx_queue_t Author:Echo Chen(陈斌) Email:chenb19870707@gmail.com Blog:Blog.csdn. ...
- nginx下目录浏览及其验证功能、版本隐藏等配置记录
工作中常常有写不能有网页下载东西的需求,在Apache下搭建完成后直接导入文件即可达到下载/显示文件的效果;而Nginx的目录列表功能默认是关闭的,如果需要打开Nginx的目录列表功能,需要手动配置, ...
- Nginx 下部署 HTTPS 与安全调优
什么是 HTTPS?# HTTPS(全称:Hyper Text Transfer Protocol over Secure Socket Layer),是以安全为目标的HTTP通道,简单讲是HTTP的 ...
- Nginx下HTTP强制重定向至HTTPS
Nginx下HTTP强制重定向至HTTPS 对于nginx来说,配置http强制重定向至https有多种多样的写法.可以直接rewrite,也可以用301重定向.但是直接拷贝网上的配置往往会出现问题, ...
随机推荐
- mongodb启动报错,child process failed, exited with error number 1
error: child process failed, exited with error number 1 第一次安装mongodb,随后启动一般不会出现上面的错误,出现这种错误的原因一般是mon ...
- 如何将一个.NET Core类库发布到NuGet
包治百病 | 如何将一个.NET Core类库发布到NuGet 写文章 包治百病 | 如何将一个.NET Core类库发布到NuGet Edi Wang发表于汪宇杰博客订阅 77 NuGet是.NET ...
- Redis中的事务及乐观锁的实现
介绍 Redis中的事务(transaction)是一组命令的集合. 事务同命令一样都是Redis最小的执行单位,一个事务中的命令要么都执行,要么都不执行. Redis事务的实现需要用 ...
- 九、LaTex中的浮动体
未利用浮动体:
- thinkphp5 select对象怎么转数组?
DB操作返回是数组.模型直接操作返回是对象 对象类型转换数组打开 database.php 增加或修改参数'resultset_type' => '\think\Collection',即可连贯 ...
- 基于linux(CentOS7)数据库性能优化(Postgresql)
基于CentOS7数据库性能优化(Postgresql) 1. 磁盘 a) Barriers IO i. 通过查看linux是否加载libata,确定是否开 ...
- 023-OpenStack 创建实例类型临时磁盘的讲解
临时磁盘占用的那块磁盘的空间查看 [root@linux-node1 dev]# fdisk -l 磁盘 /dev/sdb:26.8 GB, 26843545600 字节,52428800 个扇区 U ...
- Win10遇到蓝屏错误CRITICAL_STRUCTURE_CORRUPTION如何解决
很多使用win10系统的用户,都曾经遇到过蓝屏故障.比如,最近有位win10用户在使用电脑时,就发现电脑突然出现了蓝屏,且提示错误CRITICAL_STRUCTURE_CORRUPTION,这是怎么回 ...
- vb中typename函数
适用于获得一个变量的类型名称的, 比如 A 是一个字符串变量,那么 TypeName(A)=String
- 1121. Damn Single (25)
"Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are suppo ...