Hello,
I am using c-client to make IMAP connection to mail server.
My application is multi-threaded and need to make multiple
client connections in different threads.
While trying to connect using mail_open in more than one thread simultaneously, I am facing
an issue.
I am getting a fetal error in log “env_init called
twice” and c-client calls abort to terminate the application.
My question is:
Can we make multiple simultaneous calls to mail_open in different threads to connect
to mail server as different mail user?
Is there another way to support multiple client connection
simultaneously?
This is stack trace of aborted thread.
[1] __sigprocmask(0x0, 0xfedfbf70, 0x0, 0x0, 0x0,
0x0), at 0xff1091f0
[2] _resetsig(0xff10b7f4, 0x0, 0x0, 0xfedffd98,
0xff11c000, 0x0), at 0xff0fe56c
[3] _sigon(0xfedffd98, 0xff1238a8, 0x6, 0xfedfc044,
0xfedffd98, 0xff12321c), at 0xff0fdd0c
[4] _thrp_kill(0x0, 0x5, 0x6, 0xff11c000, 0x5,
0xff0c0458), at 0xff100d4c
[5] raise(0x6, 0x0, 0x0, 0xffffffff, 0x1da3e0,
0xfedfba10), at 0xff04bce0
[6] abort(0xff0bc008, 0x1a3b50, 0x1d45b0, 0x0, 0x0,
0xef000), at 0xff035984
[7] fatal(string = ???) (optimized), at 0x2b708 (line
~38) in "ftl_unix.c"
[8] env_init(user = ???, home = ???) (optimized), at
0x2f3ec (line ~798) in "env_unix.c"
[9] myusername_full(flags = ???) (optimized), at
0x2f978 (line ~901) in "env_unix.c"
[10] tcp_aopen(mb = ???, service = ???, usrbuf = ???)
(optimized), at 0x33a00 (line ~373) in "tcp_unix.c"
[11] net_aopen(dv = ???, mb = ???, service = ???,
user = ???) (optimized), at 0x49cac (line ~6211) in "mail.c"
[12] imap_rimap(stream = ???, service = ???, mb =
???, usr = ???, tmp = ???) (optimized), at 0x64220 (line ~1033) in
"imap4r1.c"
[13] imap_open(stream = ???) (optimized), at 0x63698
(line ~869) in "imap4r1.c"
[14] mail_open_work(d = ???, stream = ???, name =
???, options = ???) (optimized), at 0x3c378 (line ~1340) in "mail.c"
[15] mail_open(stream = ???, name = ???, options =
???) (optimized), at 0x3bebc (line ~1262) in "mail.c"
[16] ImapClient::connectToServer(this = ???)
(optimized), at 0xaae10 (line ~48) in "ImapClient.c"
[17] ImapClientMgr::getNewImapClient(this = ???,
p_MailHost = CLASS, p_Username = CLASS, p_Password = CLASS) (optimized), at
0x29540 (line ~39) in "ImapClientMgr.c"
[18] ImapThreadFunc(arg = ???) (optimized), at
0x2a8dc (line ~42) in "ClientWrapperMain.c"
Thanks and Regards,
Pankaj Bathwal