[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] help about an error message





On Tue, Mar 26, 2013 at 10:04 AM, Azat Khuzhin <dohardgopro@xxxxxxxxx> wrote:
Hi,

On Tue, Mar 26, 2013 at 2:22 AM, sven falempin <sven.falempin@xxxxxxxxx> wrote:
> using libevent2 (libevent-2.0.21-stable) i create this log:
>
> [warn] event_del: event has no event_base set.
> [err] event_assign called on an already added event 0x84de9e4 (events: 0x0,
> fd: 0, flags: 0x0)
>
> using this code:
>
> void connection::listen_write_event() {
> Â int rc = 0;
> Â if (fd == -1) return;
> Â if (is_listening_write) return;
> Â is_listening_write = 1;
> #ifdef DEBUG
> Â Â Â fprintf(stderr,"%d:%08X, LISTEN WRITING\n",fd, (unsigned
> int)pthread_self());
> #endif
> Â event_del(&_sock_ev_write);

What is "_sock_ev_write" how you initialize it?
On stack I suppose?

Why do you call event_del() if you don't set event_base for it?
You install base, on the next line.

_sock_ev_write is a member of connection.

each client get a connection object created.
the program listen the write event after having writing to socket.
so i delete the event set the previous time.

i do not want useÂEV_PERSIST (because i read in another thread)
Â


> Â rc = event_assign(&_sock_ev_write, s->get_evt_base(),
> Â Â fd, EV_WRITE,
> Â Â server::con_ready_pattern, this);
> Â if (rc == 0)
> Â Â event_add(&_sock_ev_write, NULL);
> Â else
> Â Â syslog( LOG_CRIT, "%d:cannot create write event",fd);
> }
>
> i cannot supress the warn even if i put an event base (probably
> missunderstood the doc)

Did saw this? It has all that you need, for now, I think.
http://www.wangafu.net/~nickm/libevent-book/Ref4_event.html

Never saw
i was used to libevent 1
when i switch to 2 i didnt saw the all buffered managment for multithreada :-(
Â
>
> i declared
> struct event_base * evt_base; as a global
>
> and get it init:
>
> #ifdef DEBUG
> Â event_enable_debug_mode();
> #endif
> Â evthread_use_pthreads();
> Â gconf.evt_base = event_base_new();
> Â if ( gconf.evt_base == NULL ) {
> Â Â syslog( LOG_ERR, "cannot allocate base for %s:%d", gconf.ip,
> gconf.port);
> Â Â return 1;
> Â }
>
> then used it everywhere
>
>
> to create the bug i connect frenzy to the server using a while true;
>
> Notice: if the program do not close the FD i exhaust the files desc before
> reaching the bug.
>
> --
> ---------------------------------------------------------------------------------------------------------------------
> () ascii ribbon campaign - against html e-mail
> /\



--
Respectfully
Azat Khuzhin
Primary email a3at.mail@xxxxxxxxx
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users  Âin the body.



--
---------------------------------------------------------------------------------------------------------------------
() ascii ribbon campaign - against html e-mailÂ
/\Â