Opened 12 years ago

Closed 12 years ago

#150 closed defect (fixed)

nginx -t success but nginx -s reload failed

Reported by: 夏 凯 Owned by: somebody
Priority: minor Milestone:
Component: nginx-core Version: 1.0.x
Keywords: Cc:
uname -a: Linux tp 2.6.32-5-686 #1 SMP Mon Jan 16 16:04:25 UTC 2012 i686 GNU/Linux
nginx -V: nginx version: nginx/1.0.15
built by gcc 4.4.5 (Debian 4.4.5-8)
configure arguments:

Description

when nginx.conf have no "\n" in it, nginx -t will succeed with the error "[emerg] no "events" section in configuration", and when you reload nginx ,the daemon process crash.
where is the command:
15:24:11#tp#conf> echo abc |sudo tee nginx.conf >/dev/null
15:24:29#tp#conf> sudo ../sbin/nginx -t
nginx: [emerg] unexpected end of file, expecting ";" or "}" in /usr/local/nginx/conf/nginx.conf:2
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
15:24:37#tp#conf> sudo ../sbin/nginx -s reload
nginx: [emerg] unexpected end of file, expecting ";" or "}" in /usr/local/nginx/conf/nginx.conf:2
15:24:40#tp#conf> ps -fe|grep nginx
root 30029 1 0 15:24 ? 00:00:00 nginx: master process ../sbin/nginx
nobody 30030 30029 0 15:24 ? 00:00:00 nginx: worker process
walkerxk 30045 29527 0 15:24 pts/4 00:00:00 grep --color nginx
15:24:43#tp#conf> echo -n abc |sudo tee nginx.conf >/dev/null
15:24:51#tp#conf> sudo ../sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: [emerg] no "events" section in configuration
15:24:54#tp#conf> ps -fe|grep nginx
root 30029 1 0 15:24 ? 00:00:00 nginx: master process ../sbin/nginx
nobody 30030 30029 0 15:24 ? 00:00:00 nginx: worker process
walkerxk 30055 29527 0 15:24 pts/4 00:00:00 grep --color nginx
15:24:58#tp#conf> sudo ../sbin/nginx -s reload
15:25:02#tp#conf> ps -fe|grep nginx
nobody 30030 1 0 15:24 ? 00:00:00 nginx: worker process
walkerxk 30068 29527 0 15:25 pts/4 00:00:00 grep --color nginx
15:25:03#tp#conf>

Change History (3)

comment:1 by Maxim Dounin, 12 years ago

In [4600/nginx]:

(The changeset message doesn't reference this ticket)

comment:2 by Maxim Dounin, 12 years ago

Fix committed, thanks.

comment:3 by Maxim Dounin, 12 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.