Couple questions about module behaviour

2015-02-11 Thread hun...@opensource.com.vn
Hello, 

I am doing some research and writing small modules using nginx. One of the 
modules is serving file which is generated dynamically based on user’s request. 
I found it’s hard to handle 2 states of user’s connection: 

1. When user request for object A and object A is being generated, server is 
processing user’s input to produce output, user closes browser, but server 
still produce output and just fire an error when it finished all the work and 
give output buffer to next filter. How to prevent this happens? 
2. When user request large static file, lets say we are using mp4 module, a 
user requests a 1GB file, he just downloaded 100MB then close the browser, 
nginx log module produce number of bytes sent in log file is the file size 
(which is the content length). How to know exactly how many bytes server sent 
to client (number of bytes that client actually received)? 

Thanks. 

 

--
Hưng
Email: hun...@opensource.com.vn



___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Re: Couple questions about module behaviour

2015-02-12 Thread hun...@opensource.com.vn

Hello, 


if you return control to the nginx event loop while generating the 
response, you may set appropriate events to detect if the client 
closed the connection.  See ngx_http_upstream_check_broken_connection() 
and related things in the ngx_http_upstream.c for an example.

Yes, it’s fine, I will take a deeper look at upstream module to find out the 
answer. Thanks. 

Log module, once you use $bytes_sent (or $body_bytes_sent, as 
logged by default) variable, logs the number of bytes sent to the 
client.  It is not the same as the number of bytes actually 
received by the client though, because there are bytes which are 
sent (i.e., passed by nginx to the socket buffer) but not yet 
received.

Well, this means there’s another parameter in log module which actually log 
number of bytes client received (other than $body_bytes_sent or $bytes_sent). ?




--
Hưng
Email: hun...@opensource.com.vn



> On Feb 12, 2015, at 8:52 PM, Maxim Dounin  wrote:
> 
> f you return control to the nginx event loop while generating the 
> response, you may set appropriate events to detect if the client 
> closed the connection.  See ngx_http_upstream_check_broken_connection() 
> and related things in the ngx_http_upstream.c for an example.

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Recommend way to write module to do expensive job

2015-03-05 Thread hun...@opensource.com.vn
Hello, 

We are about to write a module that’s similar to image filter module, the 
difference is image filter module processes JPEG, PNG… format, we work on video 
file, so it’s much bigger and video processing is too much longer. 

As in nginx mp4 module ( we use h264) too, client just need to receive moov 
atom data to start playback, my module should be able to produce moov atom and 
send those bytes to client while processing other part of video file. Maybe I 
ask is there any recommend way to do this? 

Thanks.

--
Hưng
Email: hun...@opensource.com.vn



___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Re: [request] create account for wiki.nginx.org

2015-03-05 Thread hun...@opensource.com.vn
off topic but your module look very good to me. 
Thanks too much for this :)

--
Hưng
Email: hun...@opensource.com.vn



> On Mar 5, 2015, at 10:52 PM, YoungJoo.Kim  wrote:
> 
> Hi folks, I have refered link to 
> http://forum.nginx.org/read.php?29,249919,249933. 
> <http://forum.nginx.org/read.php?29,249919,249933.>
>  
> A few days ago, I opened an nginx module to output the status of virtual host 
> traffic(including upstreams) at http://github.com/vozlt/nginx-module-vts. 
> <http://github.com/vozlt/nginx-module-vts.>
> I'd like to register into http://wiki.nginx.org/3rdPartyModules 
> <http://wiki.nginx.org/3rdPartyModules> to listen more feedback.
> So I have been a request one to obtain a user account and confirmed email 
> address last week.
> The requested account is vozlt.
> When can I get the account?
> ___
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Re: Couple questions about module behaviour

2015-03-16 Thread hun...@opensource.com.vn
Hello, 
> No, it means that a server don't know how many bytes a client 
> actually recieved.

So can we know how many bytes server actually sent (write to the socket)? 

Thanks.

—

Hưng
Email: hun...@opensource.com.vn



> On Feb 13, 2015, at 8:15 PM, Maxim Dounin  wrote:
> 
> Hello!
> 
> On Fri, Feb 13, 2015 at 09:49:08AM +0700, hun...@opensource.com.vn wrote:
> 
>> Well, this means there’s another parameter in log module which 
>> actually log number of bytes client received (other than 
>> $body_bytes_sent or $bytes_sent). ?
> 
> No, it means that a server don't know how many bytes a client 
> actually recieved.
> 
> -- 
> Maxim Dounin
> http://nginx.org/
> 
> ___
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Re: Couple questions about module behaviour

2015-03-17 Thread hun...@opensource.com.vn
Hello,

No, it’s not. If you take a look at ngx_http_log_module.c, r->connection->sent 
is use by function ngx_http_log_bytes_sent, which is later logged as 
$byte_sents variable, and it’s actually file size. 


--
Hưng
Email: hun...@opensource.com.vn



> On Mar 17, 2015, at 1:57 PM, Anatoli Marinov  wrote:
> 
> r->connection->sent ?
> 
> 
> On Tue, Mar 17, 2015 at 8:56 AM, hun...@opensource.com.vn 
> <mailto:hun...@opensource.com.vn>  <mailto:hun...@opensource.com.vn>> wrote:
> Hello,
> > No, it means that a server don't know how many bytes a client
> > actually recieved.
> 
> So can we know how many bytes server actually sent (write to the socket)?
> 
> Thanks.
> 
> —
> 
> Hưng
> Email: hun...@opensource.com.vn <mailto:hun...@opensource.com.vn>
> 
> 
> 
> > On Feb 13, 2015, at 8:15 PM, Maxim Dounin  > <mailto:mdou...@mdounin.ru>> wrote:
> >
> > Hello!
> >
> > On Fri, Feb 13, 2015 at 09:49:08AM +0700, hun...@opensource.com.vn 
> > <mailto:hun...@opensource.com.vn> wrote:
> >
> >> Well, this means there’s another parameter in log module which
> >> actually log number of bytes client received (other than
> >> $body_bytes_sent or $bytes_sent). ?
> >
> > No, it means that a server don't know how many bytes a client
> > actually recieved.
> >
> > --
> > Maxim Dounin
> > http://nginx.org/ <http://nginx.org/>
> >
> > ___
> > nginx-devel mailing list
> > nginx-devel@nginx.org <mailto:nginx-devel@nginx.org>
> > http://mailman.nginx.org/mailman/listinfo/nginx-devel 
> > <http://mailman.nginx.org/mailman/listinfo/nginx-devel>
> 
> ___
> nginx-devel mailing list
> nginx-devel@nginx.org <mailto:nginx-devel@nginx.org>
> http://mailman.nginx.org/mailman/listinfo/nginx-devel 
> <http://mailman.nginx.org/mailman/listinfo/nginx-devel>
> ___
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Update content on nginx-wiki

2015-04-15 Thread hun...@opensource.com.vn
Hello, 

I recently wrote a nginx module 
(https://github.com/whatvn/ngx_http_estreaming_module 
<https://github.com/whatvn/ngx_http_estreaming_module>) and I want to add it to 
3rd party module page, I made request to create wiki account and verified 
already, but maybe it’s gone nowhere.
Could someone from nginx can create an account for me on wiki page? 

Thanks, 


--
Hưng
Email: hun...@opensource.com.vn



___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

[1.8.0 stable] bug when install on old linux version

2015-05-06 Thread hun...@opensource.com.vn

Hello, 

I tested new stable version (1.8.0) with simple option: ./configure 
—add-module=./ngx_enhance_mp4_module 
(https://github.com/whatvn/ngx_http_enhance_mp4_module 
<https://github.com/whatvn/ngx_http_enhance_mp4_module>) , then start nginx and 
it fail to spawn child process (with error similar to compiling with 
—with-file-aio on old linux kernel): 

2015/05/06 14:22:28 [emerg] 19004#0: eventfd() failed (38: Function not 
implemented)
2015/05/06 14:22:28 [emerg] 19005#0: eventfd() failed (38: Function not 
implemented)
2015/05/06 14:22:28 [emerg] 19006#0: eventfd() failed (38: Function not 
implemented)
2015/05/06 14:22:28 [alert] 18999#0: worker process 19000 exited with fatal 
code 2 and cannot be respawned
2015/05/06 14:22:28 [alert] 18999#0: worker process 19002 exited with fatal 
code 2 and cannot be respawned
2015/05/06 14:22:28 [alert] 18999#0: worker process 19003 exited with fatal 
code 2 and cannot be respawned
2015/05/06 14:22:28 [alert] 18999#0: worker process 19004 exited with fatal 
code 2 and cannot be respawned
2015/05/06 14:22:28 [alert] 18999#0: worker process 19005 exited with fatal 
code 2 and cannot be respawned
2015/05/06 14:22:28 [alert] 18999#0: worker process 19006 exited with fatal 
code 2 and cannot be respawned



with same configure options, nginx stable 1.6.3 work fine. Maybe a bug? 

System details: 

Centos 5, kernel: 2.6.18-164.el5 



--
Hưng
Email: hun...@opensource.com.vn



___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Re: [1.8.0 stable] bug when install on old linux version

2015-05-06 Thread hun...@opensource.com.vn
Hello, 

This patch works, thanks.

@Filipe: Thanks. I will fix that. But I don’t know where is `6d468b45f40e`? I 
don’t see any pull request. 

Thanks 

--
Hưng
Email: hun...@opensource.com.vn



> On May 6, 2015, at 8:42 PM, Ruslan Ermilov  wrote:
> 
> Could you verify that this patch helps you?
> 
> diff --git a/src/event/modules/ngx_epoll_module.c 
> b/src/event/modules/ngx_epoll_module.c
> --- a/src/event/modules/ngx_epoll_module.c
> +++ b/src/event/modules/ngx_epoll_module.c
> @@ -329,7 +329,7 @@ ngx_epoll_init(ngx_cycle_t *cycle, ngx_m
> 
> #if (NGX_HAVE_EVENTFD)
> if (ngx_epoll_notify_init(cycle->log) != NGX_OK) {
> -return NGX_ERROR;
> +ngx_epoll_module_ctx.actions.notify = NULL;
> }
> #endif

___
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel