Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
caoersss
oceanbase
提交
137a8f1f
O
oceanbase
项目概览
caoersss
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
137a8f1f
编写于
9月 18, 2021
作者:
X
xuhuleon
提交者:
wangzelin.wzl
9月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support asan and fix several memory bug
上级
e4b3157f
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
54 addition
and
22 deletion
+54
-22
CMakeLists.txt
CMakeLists.txt
+5
-0
cmake/Env.cmake
cmake/Env.cmake
+6
-0
deps/oblib/src/lib/alloc/ob_malloc_allocator.cpp
deps/oblib/src/lib/alloc/ob_malloc_allocator.cpp
+6
-6
deps/oblib/src/lib/resource/achunk_mgr.h
deps/oblib/src/lib/resource/achunk_mgr.h
+10
-1
deps/oblib/src/lib/signal/ob_signal_handlers.cpp
deps/oblib/src/lib/signal/ob_signal_handlers.cpp
+5
-1
deps/oblib/src/lib/utility/utility.cpp
deps/oblib/src/lib/utility/utility.cpp
+1
-1
src/observer/CMakeLists.txt
src/observer/CMakeLists.txt
+6
-1
src/observer/main.cpp
src/observer/main.cpp
+2
-0
src/observer/table/ob_table_rpc_processor.cpp
src/observer/table/ob_table_rpc_processor.cpp
+0
-10
src/observer/table/ob_table_rpc_processor.h
src/observer/table/ob_table_rpc_processor.h
+13
-2
未找到文件。
CMakeLists.txt
浏览文件 @
137a8f1f
...
...
@@ -21,6 +21,11 @@ if(WITH_OSS)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-D_WITH_OSS"
)
endif
()
if
(
OB_USE_ASAN
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-DOB_USE_ASAN"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DOB_USE_ASAN"
)
endif
()
message
(
STATUS
"This is BINARY dir "
${
PROJECT_BINARY_DIR
}
)
message
(
STATUS
"This is SOURCE dir "
${
PROJECT_SOURCE_DIR
}
)
...
...
cmake/Env.cmake
浏览文件 @
137a8f1f
...
...
@@ -60,6 +60,12 @@ if (OB_USE_CLANG)
set
(
BUILD_OPT
"
${
BUILD_OPT
}
-I
${
DEVTOOLS_DIR
}
/lib/clang/11.0.1/include"
)
set
(
LD_OPT
"
${
LD_OPT
}
-Wl,-z,noexecstack"
)
if
(
OB_USE_ASAN
)
ob_define
(
CMAKE_ASAN_FLAG
"-fstack-protector-strong -fsanitize=address -fno-optimize-sibling-calls"
)
set
(
BUILD_OPT
"
${
BUILD_OPT
}
${
CMAKE_ASAN_FLAG
}
"
)
endif
()
if
(
OB_USE_LLVM_LIBTOOLS
)
set
(
LD_OPT
"
${
LD_OPT
}
-fuse-ld=
${
LD_BIN
}
"
)
endif
()
...
...
deps/oblib/src/lib/alloc/ob_malloc_allocator.cpp
浏览文件 @
137a8f1f
...
...
@@ -54,8 +54,8 @@ void* ObMallocAllocator::alloc(const int64_t size)
void
*
ObMallocAllocator
::
alloc
(
const
int64_t
size
,
const
oceanbase
::
lib
::
ObMemAttr
&
attr
)
{
#if
PERF_MODE
UNUSED
(
_
attr
);
#if
def OB_USE_ASAN
UNUSED
(
attr
);
return
::
malloc
(
size
);
#else
int
ret
=
E
(
EventTable
::
EN_4
)
OB_SUCCESS
;
...
...
@@ -111,12 +111,12 @@ void* ObMallocAllocator::alloc(const int64_t size, const oceanbase::lib::ObMemAt
}
return
ptr
;
#endif
// PERF_MODE
#endif
}
void
*
ObMallocAllocator
::
realloc
(
const
void
*
ptr
,
const
int64_t
size
,
const
oceanbase
::
lib
::
ObMemAttr
&
attr
)
{
#if
PERF_MODE
#if
def OB_USE_ASAN
UNUSED
(
attr
);
return
::
realloc
(
const_cast
<
void
*>
(
ptr
),
size
);
#else
...
...
@@ -157,12 +157,12 @@ void* ObMallocAllocator::realloc(const void* ptr, const int64_t size, const ocea
}
return
nptr
;
;
#endif
// PERF_MODE
#endif
}
void
ObMallocAllocator
::
free
(
void
*
ptr
)
{
#if
PERF_MODE
#if
def OB_USE_ASAN
::
free
(
ptr
);
#else
// directly free object instead of using tenant allocator.
...
...
deps/oblib/src/lib/resource/achunk_mgr.h
浏览文件 @
137a8f1f
...
...
@@ -46,13 +46,22 @@ public:
pushes_
(
0
),
pops_
(
0
),
with_mutex_
(
with_mutex
)
{}
{
#ifdef OB_USE_ASAN
max_chunk_cache_cnt_
=
0
;
#endif
}
virtual
~
AChunkList
()
{}
void
set_max_chunk_cache_cnt
(
const
int
cnt
)
{
#ifdef OB_USE_ASAN
UNUSED
(
cnt
);
max_chunk_cache_cnt_
=
0
;
#else
max_chunk_cache_cnt_
=
cnt
;
#endif
}
inline
bool
push
(
AChunk
*
chunk
)
...
...
deps/oblib/src/lib/signal/ob_signal_handlers.cpp
浏览文件 @
137a8f1f
...
...
@@ -25,16 +25,19 @@ namespace oceanbase {
namespace
common
{
static
const
int
SIG_SET
[]
=
{
SIGABRT
,
SIGBUS
,
SIGFPE
,
SIGSEGV
,
SIGURG
};
static
inline
void
handler
(
int
sig
,
siginfo_t
*
s
,
void
*
p
)
#ifndef OB_USE_ASAN
static
inline
void
handler
(
int
sig
,
siginfo_t
*
s
,
void
*
p
)
{
if
(
tl_handler
!=
nullptr
)
{
tl_handler
(
sig
,
s
,
p
);
}
}
#endif
int
install_ob_signal_handler
()
{
int
ret
=
OB_SUCCESS
;
#ifndef OB_USE_ASAN
struct
sigaction
sa
;
sa
.
sa_flags
=
SA_SIGINFO
|
SA_RESTART
|
SA_NODEFER
|
SA_ONSTACK
;
sa
.
sa_sigaction
=
handler
;
...
...
@@ -44,6 +47,7 @@ int install_ob_signal_handler()
ret
=
OB_INIT_FAIL
;
}
}
#endif
return
ret
;
}
...
...
deps/oblib/src/lib/utility/utility.cpp
浏览文件 @
137a8f1f
...
...
@@ -1103,7 +1103,7 @@ const char* get_default_if()
if
(
file
)
{
char
dest
[
16
]
=
{};
char
gw
[
16
]
=
{};
char
remain
[
1024
]
=
{};
char
remain
[
1024
+
1
]
=
{};
if
(
1
==
fscanf
(
file
,
"%1024[^
\n
]
\n
"
,
remain
))
{
while
(
1
)
{
int
r
=
fscanf
(
file
,
"%127s
\t
%15s
\t
%15s
\t
%1023[^
\n
]
\n
"
,
ifname
,
dest
,
gw
,
remain
);
...
...
src/observer/CMakeLists.txt
浏览文件 @
137a8f1f
...
...
@@ -320,13 +320,18 @@ if (OB_STATIC_LINK_LGPL_DEPS)
endif
()
add_executable
(
observer
)
if
(
NOT OB_USE_ASAN
)
set
(
link_malloc_hook malloc_hook
)
endif
()
target_link_libraries
(
observer
PRIVATE
ob_main
oceanbase_static
-static-libgcc
-static-libstdc++
malloc_hook
${
link_malloc_hook
}
${
LGPL_DEPS
}
)
execute_process
(
...
...
src/observer/main.cpp
浏览文件 @
137a8f1f
...
...
@@ -361,7 +361,9 @@ static void print_all_limits()
int
main
(
int
argc
,
char
*
argv
[])
{
#ifndef OB_USE_ASAN
init_malloc_hook
();
#endif
int64_t
memory_used
=
get_virtual_memory_used
();
/**
signal handler stack
...
...
src/observer/table/ob_table_rpc_processor.cpp
浏览文件 @
137a8f1f
...
...
@@ -958,16 +958,6 @@ void ObTableRpcProcessor<T>::set_req_has_wokenup()
RpcProcessor
::
req_has_wokenup_
=
true
;
}
template
<
class
T
>
int64_t
ObTableRpcProcessor
<
T
>::
get_timeout_ts
()
const
{
int64_t
ts
=
0
;
if
(
NULL
!=
RpcProcessor
::
rpc_pkt_
)
{
ts
=
RpcProcessor
::
get_receive_timestamp
()
+
RpcProcessor
::
rpc_pkt_
->
get_timeout
();
}
return
ts
;
}
template
<
class
T
>
void
ObTableRpcProcessor
<
T
>::
save_request_string
()
{
...
...
src/observer/table/ob_table_rpc_processor.h
浏览文件 @
137a8f1f
...
...
@@ -214,6 +214,17 @@ protected:
};
template
<
class
T
>
int64_t
ObTableRpcProcessor
<
T
>::
get_timeout_ts
()
const
{
int64_t
ts
=
0
;
if
(
NULL
!=
RpcProcessor
::
rpc_pkt_
)
{
ts
=
RpcProcessor
::
get_receive_timestamp
()
+
RpcProcessor
::
rpc_pkt_
->
get_timeout
();
}
return
ts
;
}
}
// end namespace observer
}
// end namespace oceanbase
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录