probably stupid questions about select() and FS_SET in a multithreaded environment [ select() failed (Bad file descriptor) ]

2011-10-16 Thread Vikash Badal
Greetings,

Can some point me in the correction direction please.

I have a treaded socket application that has a problem with select() returning 
-1.
The select() and accept() is taken care of in one thread. The worker threads 
deal with client requests after the new client connection is pushed to queue.

The logged error is :
select() failed (Bad file descriptor) getdtablesize = 65536

Sysctls at the moment  are:
kern.maxfiles: 65536 
kern.maxfilesperproc: 65536


code
void client_accept(int listen_socket)
{
...
   while ( loop )
   {
  FD_ZERO(socket_set);
  FD_SET(listen_socket, socket_set);
  timeout.tv_sec = 1;
  timeout.tv_usec = 0;

  rcode = select(listen_socket + 1, socket_set, NULL, NULL, timeout);

  if ( rcode  0 )
  {
 Log(DEBUG_0, ERROR: select() failed (%s) getdtablesize = %d,
 strerror(errno), getdtablesize());
 loop = 0;
 sleep(30);
 fcloseall();
 assert(1==0);
  }

  if ( rcode  0 )
  {
  remotelen = sizeof(remote);
  client_sock = accept(listen_socket, .
  
  if (msgsock != -1 )
  { 
 // Allocate memory for request
 request = malloc(sizeof(struct requests));
 // test for malloc etc ...
 // set request values ...
 //
 // Push request to a queue. 
  }
  }

   }
 ...
}
void* tcpworker(void* arg)
{
   // initialise stuff

   While ( loop )
   {
  // pop request from queue
  
  If ( request != NULL )
  {
 // deal with request
 free(request)
  }
   }   
}

/code
When the problem occurs, i have between 1000 and 1400 clients connected.

Questions:
1. do i need to FD_CLR(client_sock,socket_set) before i push to a queue ?
2. do i need to FD_CLR(client_sock, socket_set) when this client request 
closes in the the tcpworker() function ?
3. would setting kern.maxfilesperproc and kern.maxfiles to higher values solve 
the problem or just take longer for the problem to re-appear.
4. should is replace select() with kqueue() as from google-ing it seems 
select() is not that great.


Thanks
Vikash

Please note: This email and its content are subject to the disclaimer as 
displayed at the following link 
http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. 
Should you not have Web access, send a mail to disclaim...@is.co.za and a copy 
will be emailed to you.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


RE: switching from gnu make to bsd make

2011-02-11 Thread Vikash Badal
 -Original Message-
 From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
 questi...@freebsd.org] On Behalf Of Robert Bonomi
 Sent: 11 February 2011 01:59 AM
 To: Vikash Badal
 Cc: freebsd-questions@freebsd.org
 Subject: Re: switching from gnu make to bsd make
 
 Try typing make all and see what happens then.
 
 

Make all produces the follow output:

make all
cc -o bin/nntpd -lpthread -lmysqlclient_r -Wall -g -Iinclude 
-I/usr/local/include -I/usr/local/include/mysql -L/usr/local/lib 
-L/usr/local/lib/mysql  obj/log.o obj/cleanup.o obj/config.o  obj/leecherpool.o 
obj/mytime.o obj/nntp.o  obj/upstream.o obj/mysleep.o obj/sqlpool.o  obj/sql.o 
obj/signalhandler.o obj/daemon.o  obj/list.o obj/tcpserver.o obj/tmpfiles.o  
obj/listenpool.o obj/workers.o  obj/nntpd.o
cc: obj/log.o: No such file or directory
cc: obj/cleanup.o: No such file or directory
cc: obj/config.o: No such file or directory
cc: obj/leecherpool.o: No such file or directory
cc: obj/mytime.o: No such file or directory
cc: obj/nntp.o: No such file or directory
cc: obj/upstream.o: No such file or directory
cc: obj/mysleep.o: No such file or directory
cc: obj/sqlpool.o: No such file or directory
cc: obj/sql.o: No such file or directory
cc: obj/signalhandler.o: No such file or directory
cc: obj/daemon.o: No such file or directory
cc: obj/list.o: No such file or directory
cc: obj/tcpserver.o: No such file or directory
cc: obj/tmpfiles.o: No such file or directory
cc: obj/listenpool.o: No such file or directory
cc: obj/workers.o: No such file or directory
cc: obj/nntpd.o: No such file or directory
*** Error code 1


With gmake :
$(OBJDIR)/%.o:${SRCDIR}/%.c
${CC} -c ${CFLAGS} ${INCDIR} ${LIBDIR} $ -o $@

This creates all the .o files I need

How do I do this with bsd make ?




 
 
  this is my make file:
 
  -
 -
 
  CC= cc
 * LIBS  = -lpthread -lmysqlclient_r
  CFLAGS= -Wall -g
  INCDIR= -Iinclude -I/usr/local/include -
 I/usr/local/include/mysql
  LIBDIR= -L/usr/local/lib -L/usr/local/lib/mysql
  OBJDIR= obj
  SRCDIR= src
  BINDIR= bin
  PREFIX= /usr/local/nntpd
  BINDIRFILES   = ${BINDIR}/nntpd
  OBJS  = ${OBJDIR}/log.o ${OBJDIR}/cleanup.o
 ${OBJDIR}/config.o \
  ${OBJDIR}/leecherpool.o ${OBJDIR}/mytime.o
  ${OBJDIR}/upstream.o ${OBJDIR}/mysleep.o
  ${OBJDIR}/sql.o ${OBJDIR}/signalhandler.o
  ${OBJDIR}/list.o ${OBJDIR}/tcpserver.o
  ${OBJDIR}/listenpool.o ${OBJDIR}/workers.o \
  ${OBJDIR}/nntpd.o
 
  $(OBJDIR)/%.o:${SRCDIR}/%.c
  ${CC} -c ${CFLAGS} ${INCDIR} ${LIBDIR} $ -o $@
 
  all:${OBJS}
  ${CC} -o ${BINDIR}/nntpd ${LIBS} ${CFLAGS} ${INCDIR}
 ${LIBDIR} \
  ${OBJDIR}/log.o ${OBJDIR}/cleanup.o ${OBJDIR}/config.o \
  ${OBJDIR}/leecherpool.o ${OBJDIR}/mytime.o ${OBJDIR}/nntp.o \
  ${OBJDIR}/upstream.o ${OBJDIR}/mysleep.o ${OBJDIR}/sqlpool.o
 \
  ${OBJDIR}/sql.o ${OBJDIR}/signalhandler.o ${OBJDIR}/daemon.o
 \
  ${OBJDIR}/list.o ${OBJDIR}/tcpserver.o ${OBJDIR}/tmpfiles.o \
  ${OBJDIR}/listenpool.o ${OBJDIR}/workers.o \
  ${OBJDIR}/nntpd.o
 
  -
 -
 
 
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-
 unsubscr...@freebsd.org
Please note: This email and its content are subject to the disclaimer as 
displayed at the following link 
http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. 
Should you not have Web access, send a mail to disclaim...@is.co.za and a copy 
will be emailed to you.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


RE: switching from gnu make to bsd make

2011-02-10 Thread Vikash Badal
 -Original Message-
 From: Polytropon [mailto:free...@edvax.de]
 Sent: 10 February 2011 10:11 AM
 To: Vikash Badal
 Cc: freebsd-questions@freebsd.org
 Subject: Re: switching from gnu make to bsd make
 
 Of course, in my testing case OBJDIR and SRCDIR are
 empty, and I didn't define any of CC, CFLAGS, INCDIR or
 LIBDIR, so the defaults have been chosen.
 
 Do you encounter a specific problem?

This is my problem:

vix:$ make
make: don't know how to make src/%.c. Stop


this is my make file:

--

CC= cc
LIBS  = -lpthread -lmysqlclient_r
CFLAGS= -Wall -g
INCDIR= -Iinclude -I/usr/local/include -I/usr/local/include/mysql
LIBDIR= -L/usr/local/lib -L/usr/local/lib/mysql
OBJDIR= obj
SRCDIR= src
BINDIR= bin
PREFIX= /usr/local/nntpd
BINDIRFILES   = ${BINDIR}/nntpd
OBJS  = ${OBJDIR}/log.o ${OBJDIR}/cleanup.o ${OBJDIR}/config.o \
${OBJDIR}/leecherpool.o ${OBJDIR}/mytime.o ${OBJDIR}/nntp.o \
${OBJDIR}/upstream.o ${OBJDIR}/mysleep.o ${OBJDIR}/sqlpool.o \
${OBJDIR}/sql.o ${OBJDIR}/signalhandler.o ${OBJDIR}/daemon.o \
${OBJDIR}/list.o ${OBJDIR}/tcpserver.o ${OBJDIR}/tmpfiles.o \
${OBJDIR}/listenpool.o ${OBJDIR}/workers.o \
${OBJDIR}/nntpd.o

$(OBJDIR)/%.o:${SRCDIR}/%.c
${CC} -c ${CFLAGS} ${INCDIR} ${LIBDIR} $ -o $@

all:${OBJS}
${CC} -o ${BINDIR}/nntpd ${LIBS} ${CFLAGS} ${INCDIR} ${LIBDIR} \
${OBJDIR}/log.o ${OBJDIR}/cleanup.o ${OBJDIR}/config.o \
${OBJDIR}/leecherpool.o ${OBJDIR}/mytime.o ${OBJDIR}/nntp.o \
${OBJDIR}/upstream.o ${OBJDIR}/mysleep.o ${OBJDIR}/sqlpool.o \
${OBJDIR}/sql.o ${OBJDIR}/signalhandler.o ${OBJDIR}/daemon.o \
${OBJDIR}/list.o ${OBJDIR}/tcpserver.o ${OBJDIR}/tmpfiles.o \
${OBJDIR}/listenpool.o ${OBJDIR}/workers.o \
${OBJDIR}/nntpd.o

--
 
 
 
 --
 Polytropon
 Magdeburg, Germany
 Happy FreeBSD user since 4.0
 Andra moi ennepe, Mousa, ...
Please note: This email and its content are subject to the disclaimer as 
displayed at the following link 
http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. 
Should you not have Web access, send a mail to disclaim...@is.co.za and a copy 
will be emailed to you.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


switching from gnu make to bsd make

2011-02-09 Thread Vikash Badal
Can someone please advise me as to how I switch the following lines of gnu make 
to bsd make


$(OBJDIR)/%.o:${SRCDIR}/%.c
${CC} -c ${CFLAGS} ${INCDIR} ${LIBDIR} $ -o $@


Thanks
Vikash

Please note: This email and its content are subject to the disclaimer as 
displayed at the following link 
http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. 
Should you not have Web access, send a mail to disclaim...@is.co.za and a copy 
will be emailed to you.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


syslog strangeness on freebsd 8.0 and 8.1-RC

2010-07-05 Thread Vikash Badal

Can someone please assist me with some strangeness on FreeBSD 8.0 and 8.1-RC2

using a threaded test code code, I see the that freebsd 8.x seems to be using 
more memory when using the syslog() call from a c program:


Results:

7.2
without syslog
  PID USERNAMETHR PRI NICE   SIZERES STATETIME   WCPU COMMAND
26872 vikashb1001   80   128M 14236K RUN  0:00  0.00% a.out

with syslog
  PID USERNAMETHR PRI NICE   SIZERES STATETIME   WCPU COMMAND
26881 vikashb1001  440   128M 26236K RUN  0:00  0.00% a.out

8.0-RELEASE-p3
without syslog
  PID USERNAMETHR PRI NICE   SIZERES STATETIME   WCPU COMMAND
61529 vikashb1001  440   129M 14840K RUN  0:01  0.00% a.out

with syslog
  PID USERNAMETHR PRI NICE   SIZERES STATETIME   WCPU COMMAND
61507 vikashb1001  440   257M 42708K RUN  0:30  0.00% a.out

8.1-RC2
without syslog
  PID USERNAMETHR PRI NICE   SIZERES STATETIME   WCPU COMMAND
33062 vikashb1001  440   129M 14804K RUN  0:00  0.00% a.out

with syslog
  PID USERNAMETHR PRI NICE   SIZERES STATETIME   WCPU COMMAND
33056 vikashb1001  440   257M 42708K RUN  0:03  0.00% a.out


I have not been able to find any reasonable information via google.

Why does syslog result in more memory being consumed on 8.x as opposed to 7.2 ?



CODE
#include stdio.h
#include stdlib.h
#include string.h
#include sys/time.h
#include stdarg.h
#include errno.h
#include syslog.h
#include signal.h
#include pthread.h

char *ProgramName = WTF;

int loop = 0;
int LogToSTDOUT = 1;

void LogMessage(int debug, const char *fmt,...)
{
   extern int LogToSTDOUT;

   char message[8192];

   memset(message, 0, sizeof(message));

   va_list args;

   va_start(args, fmt);
   vsnprintf(message, sizeof(message), fmt, args);
   va_end(args);

   if ( LogToSTDOUT )
   {
  printf(%s\n, message);
   }

   syslog(LOG_NOTICE, %s, message);

}

unsigned long int getTimeNow()
{
   struct timeval tv;

   if ( gettimeofday(tv, NULL) == -1 )
   {
  LogMessage(0, ERROR(%d) %s\n, errno, strerror(errno));
  tv.tv_sec = 0;
   }

   return tv.tv_sec;
}

void HandleSignal(int sig)
{
   loop = 0;
   LogMessage(0, loop  = %d\n, loop);
   signal(sig, SIG_IGN);
   usleep(1000);
}

void *worker(int n)
{
   while ( loop )
   {
  LogMessage(0, worker #%d logging, n);
  usleep(1000);
   }

   pthread_exit(0);
}

int main(int argc, char* argv[])
{
   pthread_t* tpool;

   int workers = 1000, i, rc;

   openlog(ProgramName, LOG_PID, LOG_MAIL);

   unsigned long int duration = 120, StartTime, TimeNow;

   signal(SIGINT, HandleSignal);
   signal(SIGTERM, HandleSignal);
   signal(SIGHUP, HandleSignal);
   signal(SIGQUIT, HandleSignal);

   StartTime = getTimeNow();

   tpool = (pthread_t*)malloc(workers * sizeof(pthread_t));

   if ( tpool == NULL )
   {
  LogMessage(0, malloc failed \n);
  closelog();
  exit(-1);
   }

   memset(tpool, 0, sizeof(pthread_t) * workers);

   loop = 1;

   for ( i = 0; i  workers; i++ )
   {
  rc = pthread_create(tpool[i], NULL, (void *(*)(void*))worker, (void*)i);

  if ( rc != 0 )
  {
 LogMessage(0, pthread_create #%d failed\n, i );
 pthread_cancel(tpool[i]);
  }
  else
  {
 pthread_detach(tpool[i]);
  }
   }

   LogMessage(0, loop  = %d\n, loop);

   while ( loop )
   {
  TimeNow = getTimeNow();

  if ( ( TimeNow - StartTime )   duration )
  {
  loop = 0;
  }

  usleep(1000);
   }

   for ( i = 0; i  workers; i++ )
   {
  pthread_cancel(tpool[i]);
   }

   for ( i = 0; i  workers; i++ )
   {
  pthread_join(tpool[i], NULL);
   }

   free(tpool);
   closelog();
   exit(0);
}

/CODE
Please note: This email and its content are subject to the disclaimer as 
displayed at the following link 
http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. 
Should you not have Web access, send a mail to disclaim...@is.co.za and a copy 
will be emailed to you.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


threads and malloc/free on freebsd 8.0

2010-06-11 Thread Vikash Badal
Greetings.

I have a thread socket application that seems to be behaving strangely

In a worker thread, I have the following.

CODE---
   LogMessage(DEBUG_0, allocated %ld, malloc_usable_size(inst));
   
   free(inst);
   
   LogMessage(DEBUG_0, after free allocated %ld, malloc_usable_size(inst));

   free(inst);
   
return 0;
---/CODE

output allocated 2304
output after free allocated 2304

from playing around, this should have segfaulted but it didn't:


if I try this from a non threaded, non socket code:
CODE--
   char *z;

   z = (char*)malloc(1000);
   printf(malloc is %ld\n, malloc_usable_size(z));
   free(z);
   printf(after malloc is %ld\n, malloc_usable_size(z));
--/CODE

Output malloc is 1024
Output Segmentation fault (core dumped)



Can anyone enlighten me ? why did the 2nd free not cause a segmentation fault ?


If im not clear, please forgive me.


Please note: This email and its content are subject to the disclaimer as 
displayed at the following link 
http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. 
Should you not have Web access, send a mail to disclaim...@is.co.za and a copy 
will be emailed to you.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


RE: threads and malloc/free on freebsd 8.0

2010-06-11 Thread Vikash Badal
 -Original Message-
 From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-
 questi...@freebsd.org] On Behalf Of Dan Nelson
 Sent: 11 June 2010 09:56 PM
 To: Vikash Badal
 Cc: freebsd-questions@freebsd.org
 Subject: Re: threads and malloc/free on freebsd 8.0
 
 
 The fix is to remove your second call to malloc_usable_size(z)).  Then
 neither version will crash.  Also, a useful habit to start is to
 explicitly
 zero the pointer you just free'd, to prevent it from being used
 accidentally
 later.

Made this change:

CODE---
   LogMessage(DEBUG_0, allocated %ld, malloc_usable_size(inst));
   
   free(inst);
   free(inst);
   
return 0;
---/CODE

Still no seg fault.

The reason im am doing this is that from top I can see the memory grow as I 
connect to this app.
When I disconnect, the memory used ( as displayed from top ) does not decrease.


I tried:
CODE-

char *chunk;
chunk = (char*) malloc(120);
sleep(30);
free(chunk)
sleep(30);

free(inst);
free(inst);

--/CODE

Top show the memory for the chunk section increase and then decrease  when freed

However, the when I leave the worker thread ( close the connection ), the 
memory usage does not decrease.

The more connections I open and close, the faster the memory grows.


 
 --
   Dan Nelson
   dnel...@allantgroup.com
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-
 unsubscr...@freebsd.org
Please note: This email and its content are subject to the disclaimer as 
displayed at the following link 
http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. 
Should you not have Web access, send a mail to disclaim...@is.co.za and a copy 
will be emailed to you.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


threads and malloc/free on freebsd 8.0

2010-05-21 Thread Vikash Badal

Greetings.

Excuse me if this is a stupid questions.

I have a thread socket application that seems to be behaving strangely

In a worker thread, I have the following.

CODE---
   LogMessage(DEBUG_0, allocated %ld, malloc_usable_size(inst));
   
   free(inst);
   
   LogMessage(DEBUG_0, after free allocated %ld, malloc_usable_size(inst));
   
return 0;
---/CODE

output allocated 2304
output after free allocated 2304

from playing around, this should have segfaulted but it didn't:

if I try this from a non threaded, non socket code:
CODE--
   char *z;

   z = (char*)malloc(1000);
   printf(malloc is %ld\n, malloc_usable_size(z));
   free(z);
   printf(after malloc is %ld\n, malloc_usable_size(z));
--/CODE

Output malloc is 1024
Output Segmentation fault (core dumped)



Can anyone enlighten me ?


If im not clear, please forgive me.


Please note: This email and its content are subject to the disclaimer as 
displayed at the following link 
http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. 
Should you not have Web access, send a mail to disclaim...@is.co.za and a copy 
will be emailed to you.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


increasing memory for no root users on freebsd 8.0

2010-05-20 Thread Vikash Badal


Can someone assist me with tunning freebsd 8.0 so that I can allocate more 
memory to a process that is not owned by root or running as root.


From top 
I get this line before it coredumps.

PID USERNAMETHR PRI NICE   SIZERES STATETIME   WCPU COMMAND
1161 nntpd  1500  440   502M   303M STOP 1:27  0.00% nntpd

The server has:
real memory  = 4294967296 (4096 MB)
avail memory = 3145883648 (3000 MB)


/boot/loader.conf
kern.maxdsiz=768M
kern.maxssiz=768M
kern.maxtsiz=768M

limits
Resource limits (current):
  cputime  infinity secs
  filesize infinity kB
  datasize   786432 kB
  stacksize  786432 kB
  coredumpsize infinity kB
  memoryuseinfinity kB
  memorylocked infinity kB
  maxprocesses 5547
  openfiles   11095
  sbsize   infinity bytes
  vmemoryuse   infinity kB
  pseudo-terminals infinity
  swapuse  infinity kB


according to tuning(7)

 The kern.dfldsiz and kern.dflssiz tunables set the default soft limits
 for process data and stack size respectively.  Processes may increase
 these up to the hard limits by calling setrlimit(2).  The kern.maxdsiz,
 kern.maxssiz, and kern.maxtsiz tunables set the hard limits for process
 data, stack, and text size respectively; processes may not exceed these
 limits.  The kern.sgrowsiz tunable controls how much the stack segment
 will grow when a process needs to allocate more stack.


But setting these values in /boot/loader.conf does not seem to solve the memory 
limits that I am hitting.

Any idea where I'm going wrong ?



Thanks

Please note: This email and its content are subject to the disclaimer as 
displayed at the following link 
http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. 
Should you not have Web access, send a mail to disclaim...@is.co.za and a copy 
will be emailed to you.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


FreeBSD 8.0 and CDN connection issue

2010-02-15 Thread Vikash Badal
Hi

We are having a strange problem with FreeBSD 8.0  ( problem is not seen
on 7.X or 6.X ) and its behavior towards what appears to be a problem
with the footprint cdn which hosts sites such as:
http://www.formula1.com
http://www.vw.com
http://www.rca.com

The issue can be seen below:

PF enabled with scrubing:

/etc/pf.conf:
#
scrub in all
pass in on lo0 all
pass out on lo0 all
pass in on em0 all
pass out on em0 all
#

telnet to cdn on port 80. 

tcpdump below:
18:09:41.625409 IP freebsd.8.51776  209.84.7.126.80: Flags [S], seq
4208441727, win 65535, options [mss 1460,nop,wscale 3,sackOK,TS val
161897 ecr 0], length 0
18:09:41.900230 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
3063615393, ack 4208441728, win 5792, options [mss 1460,sackOK,TS val
81367 ecr 161897,nop,wscale 7], length 0
18:09:41.900236 IP freebsd.8.51776  209.84.7.126.80: Flags [.], ack 1,
win 8326, options [nop,nop,TS val 161924 ecr 81367], length 0
18:09:41.900242 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
3332367005, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900248 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
4174817132, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900254 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
440460550, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900467 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
477325580, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900473 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
769752490, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900479 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
629432722, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900485 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
4152361545, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900491 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
1928751848, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900497 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
3230160684, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900503 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
1491106974, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900509 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
2033022417, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900515 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
1187979504, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900521 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
797713074, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900527 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
3546267649, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900533 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
245712922, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.900539 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
1525656528, ack 4208441728, win 5840, options [mss 1460], length 0
18:09:41.901017 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
2249622145, ack 4208441728, win 5792, options [mss 1460,sackOK,TS val
246213904 ecr 161897,nop,wscale 7], length 0
18:09:46.241996 IP 209.84.7.126.80  freebsd.8.51776: Flags [S.], seq
2249622145, ack 4208441728, win 5792, options [mss 1460,sackOK,TS val
246214338 ecr 161897,nop,wscale 7], length 0


pf disabled:

telnet 209.84.7.126 80
Trying 209.84.7.126...
telnet: connect to address 209.84.7.126: Connection reset by peer
telnet: Unable to connect to remote host



tcpdump:
18:11:29.122444 IP freebsd.8.41986  209.84.7.126.80: Flags [S], seq
2294539745, win 65535, options [mss 1460,nop,wscale 3,sackOK,TS val
172648 ecr 0], length 0
18:11:29.395219 IP 209.84.7.126.80  freebsd.8.41986: Flags [S.], seq
2724299112, ack 2294539746, win 5792, options [mss 1460,sackOK,TS val
813551987 ecr 172648,nop,wscale 7], length 0
18:11:29.395225 IP freebsd.8.41986  209.84.7.126.80: Flags [.], ack 1,
win 8326, options [nop,nop,TS val 172676 ecr 813551987], length 0
18:11:29.395231 IP 209.84.7.126.80  freebsd.8.41986: Flags [S.], seq
3789304658, ack 2294539746, win 5840, options [mss 1460], length 0
18:11:29.395237 IP freebsd.8.41986  209.84.7.126.80: Flags [.], ack
3229961751, win 8326, options [nop,nop,TS val 172676 ecr 813551987],
length 0
18:11:29.395243 IP 209.84.7.126.80  freebsd.8.41986: Flags [S.], seq
3256912235, ack 2294539746, win 5840, options [mss 1460], length 0
18:11:29.395249 IP freebsd.8.41986  209.84.7.126.80: Flags [.], ack
3762354174, win 8326, options [nop,nop,TS val 172676 ecr 813551987],
length 0
18:11:29.395255 IP 209.84.7.126.80  freebsd.8.41986: Flags [S.], seq
737801599, ack 2294539746, win 5840, options [mss 1460], length 0
18:11:29.395261 IP freebsd.8.41986  209.84.7.126.80: Flags [R.], seq 1,
ack 1986497514, win 8326, options [nop,nop,TS val 172676 ecr 

growing a graid3 array and growfs not growing ....

2009-05-29 Thread Vikash Badal
Can someone please advise why growfs would return:
growfs: we are not growing (8388607-4194303) ?


I have a FreeBSD 7.2 server in a VM.
I initially had 5 x 4G disks

Created a raid
graid3 label datavol da2 da3 da4 da5 da6

I upgraded them to 5 x 8g disks

swopped out the virtual disks one at a time

graid3 remove -n 0 datavol
graid3 insert -n 0 datavol da2
[wait]
..
graid3 remove -n 4 datavol
graid3 insert -n 4 datavol da6
[wait]

graid3 stop datavol
growfs /dev/raid3/datavol

error message: growfs: we are not growing (8388607-4194303) ?

vix-sw-raid# graid3 list
Geom name: datavol
State: COMPLETE
Components: 5
Flags: NONE
GenID: 0
SyncID: 1
ID: 2704170828
Zone64kFailed: 0
Zone64kRequested: 0
Zone16kFailed: 0
Zone16kRequested: 0
Zone4kFailed: 0
Zone4kRequested: 524
Providers:
1. Name: raid3/datavol
   Mediasize: 34359736320 (32G)
   Sectorsize: 2048
   Mode: r0w0e0
Consumers:
1. Name: da2
   Mediasize: 8589934592 (8.0G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Flags: NONE
   GenID: 0
   SyncID: 1
   Number: 0
   Type: DATA
2. Name: da3
   Mediasize: 8589934592 (8.0G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Flags: NONE
   GenID: 0
   SyncID: 1
   Number: 1
   Type: DATA
3. Name: da4
   Mediasize: 8589934592 (8.0G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Flags: NONE
   GenID: 0
   SyncID: 1
   Number: 2
   Type: DATA
4. Name: da5
   Mediasize: 8589934592 (8.0G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Flags: NONE
   GenID: 0
   SyncID: 1
   Number: 3
   Type: DATA
5. Name: da6
   Mediasize: 8589934592 (8.0G)
   Sectorsize: 512
   Mode: r1w1e1
   State: ACTIVE
   Flags: NONE
   GenID: 0
   SyncID: 1
   Number: 4
   Type: PARITY


fdisk /dev/raid3/datavol
*** Working on device /dev/raid3/datavol ***
parameters extracted from in-core disklabel are:
cylinders=1044 heads=255 sectors/track=63 (16065 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=1044 heads=255 sectors/track=63 (16065 blks/cyl)

fdisk: invalid fdisk partition table found
fdisk: /boot/mbr: length must be a multiple of sector size


what am I missing ?









Please note: This email and its content are subject to the disclaimer as 
displayed at the following link 
http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. 
Should you not have Web access, send a mail to disclaim...@is.co.za and a copy 
will be emailed to you.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


RE: How do I use more process memory with mysqld

2008-04-16 Thread Vikash Badal
 -Original Message-
 From: Mel [mailto:[EMAIL PROTECTED] 
 Sent: 15 April 2008 07:52 PM
 To: freebsd-questions@freebsd.org
 Cc: Vikash Badal
 Subject: Re: How do I use more process memory with mysqld
 
 On Tuesday 15 April 2008 17:07:14 Vikash Badal wrote:
 
datasize 33554432 kB
 
 That says 3G.
 
 
  48647 mysql  35  200   963M   938M kserel 0 718.9H 
 22.17% mysqld
 
 Your my.cnf is missing. Are you sure you're allowing mysql to 
 go beyong 1G?

Sorry about that ... Missed that one.

My.cnf:
~~
# The MySQL server
[mysqld]
key_buffer = 768M
max_allowed_packet = 2M
table_cache = 1024
sort_buffer_size = 4M
read_buffer_size = 4M
read_rnd_buffer_size = 16M
myisam_sort_buffer_size = 128M
thread_cache_size = 8
query_cache_size = 64M
max_connections = 200
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

server-id   = 31

aths to different dedicated disks
#tmpdir = /tmp/
tmpdir  = /mnt/ramfs/tmp/

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[isamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M


Please note: This email and its content are subject to the disclaimer as 
displayed at the following link 
http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. 
Should you not have Web access, send a mail to [EMAIL PROTECTED] and a copy 
will be emailed to you.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


How do I use more process memory with mysqld

2008-04-15 Thread Vikash Badal

Greetings,

I am trying to get mysql to use more memory, at present it seems stuck
at around 1G

From the mysql lists the it was suggested that I increase kern.maxdsiz,
kern.dfdl, kern.maxssiz

In /boot/loader.conf.


Having set the values of kern.maxdsiz and  kern.dfdl mto 6G, I still
cant use more than 1G on mysql:


sysctl -a | grep kern.max
kern.maxvnodes: 10
kern.maxproc: 6164
kern.maxfiles: 12328
kern.maxfilesperproc: 11095
kern.maxprocperuid: 5547
kern.maxusers: 384


From dmesg:

CPU: Intel(R) Xeon(TM) CPU 2.80GHz (2793.20-MHz K8-class CPU)
  Origin = GenuineIntel  Id = 0xf48  Stepping = 8
 
Features=0xbfebfbffFPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE
,MCA,C
MOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE
  Features2=0x649dSSE3,RSVD2,MON,DS_CPL,EST,CNTX-ID,CX16,b14
  AMD Features=0x20100800SYSCALL,NX,LM
  AMD Features2=0x1LAHF
  Cores per package: 2
  Logical CPUs per core: 2
real memory  = 17716740096 (16896 MB)
avail memory = 16638013440 (15867 MB)


uname -a
FreeBSD greateastern.dial-up.net 6.1-RELEASE-p5 FreeBSD 6.1-RELEASE-p5
#0:

limits -H
Resource limits (current):
  cputime  infinity secs
  filesize infinity kB
  datasize 33554432 kB
  stacksize  524288 kB
  coredumpsize infinity kB
  memoryuseinfinity kB
  memorylocked infinity kB
  maxprocesses 5547
  openfiles   11095
  sbsize   infinity bytes
  vmemoryuse   infinity kB

From top

93 processes:  1 running, 92 sleeping
CPU states:  1.1% user,  0.0% nice,  0.6% system,  0.1% interrupt, 98.2%
idle
Mem: 980M Active, 8893M Inact, 344M Wired, 616M Cache, 214M Buf, 2477M
Free
Swap: 31G Total, 116K Used, 31G Free

  PID USERNAME  THR PRI NICE   SIZERES STATE  C   TIME   WCPU
COMMAND
48647 mysql  35  200   963M   938M kserel 0 718.9H 22.17% mysqld



Please advise

Vikash
Please note: This email and its content are subject to the disclaimer as 
displayed at the following link 
http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. 
Should you not have Web access, send a mail to [EMAIL PROTECTED] and a copy 
will be emailed to you.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


nntpcache ( news/nntpcache ) on AMD 64 (6.2-RELEASE)

2007-02-21 Thread Vikash Badal
Greetings,

Has anyone been able to get nntpcache working on AMD64 (6.2-RELEASE)

The same ports tree compiles on 6.2-RELEASE i386 and work 100%

Compiling on AMD64 results in :

connected to NNTP server vasbyt.local.net as DEFAULT
= [vasbyt.local.net] list overview.fmt
refused list overview.fmt on vasbyt.local.net: '430 Dont have it'
checking server vasbyt.local.net for 'active'
= [vasbyt.isdsl.net] list
refused list active on vasbyt.local.net: '500 Syntax error or bad
command'
checking server vasbyt.local.net for 'active.times'
= [vasbyt.isdsl.net] list active.times
parsing 'active.times' from vasbyt.local.net
page error



please advise
Please note: This email and its content are subject to the disclaimer as 
displayed at the following link 
http://www.is.co.za/legal/E-mail+Confidentiality+Notice+and+Disclaimer.htm. 
Should you not have Web access, send a mail to [EMAIL PROTECTED] and a copy 
will be emailed to you.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


port source list from www.freebsd.org

2005-02-08 Thread Vikash Badal
Greetings,
I have looked at the following url :
http://www.freebsd.org/cgi/pds.cgi?ports/www/squid
and the sources are no longer listed, is this the default or is there 
a problem with the pages

I have tried several different ports and all produce the same result:
 Sorry, did not find the sources for ports/category/portname  
Thanks
vikash

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


libidn-0.4.1 on FreeBSD4.8-p17

2004-03-18 Thread Vikash Badal - PCS
Greetings,

I am unable to compile libidn-0.4.1, error message:

Making all in tld
restore=:   backupdir=.am$$   am__cwd=`pwd`  cd .   rm -rf $backupdir  
mkdir $backupdir   for f in ./libidn.info ./libidn.info-[0-9] 
./libidn.info-[0-9][0-9] ./libidn.i[0-9] ./libidn.i[0-9][0-9]; do  if test -f $f; then 
 mv $f $backupdir;  restore=mv;  fi;  done;  cd $am__cwd;  if /bin/sh 
/usr/ports/devel/libidn/work/libidn-0.4.1/missing --run makeinfo   -I .  -o 
./libidn.info ./libidn.texi;  then  rc=0;  cd .;  else  rc=$?;  cd .   $restore 
$backupdir/* `echo ././libidn.info | sed 's|[^/]*$||'`;  fi;  rm -rf $backupdir;  
exit $rc
./libidn.texi:211: @image file `components.txt' (for text) unreadable: No such file or 
directory.
makeinfo: Removing output file `./libidn.info' due to errors; use --force to preserve.
*** Error code 1

Stop in /usr/ports/devel/libidn/work/libidn-0.4.1/doc.
*** Error code 1

please advise

Thanks
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Source nat question (ipfw and natd)

2003-01-26 Thread Vikash Badal
Hi Nick,

- Original Message -
From: Nick Rogness [EMAIL PROTECTED]
To: Vikash Badal [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, January 26, 2003 2:01 AM
Subject: Re: Source nat question (ipfw and natd)


 On Sat, 25 Jan 2003, Vikash Badal wrote:

  Greetings,
 
  I currently have a box (4.7p3) that i want to connect to four different
  networks According to the man page i can only nat on one interface using
  natd.
 
  My current natd.conf is as follows :
  --
  redirect_address 10.136.236.18 192.168.28.61
  redirect_address 10.136.236.20 192.168.20.47
  redirect_address 10.136.236.19 192.167.11.47
  --
 
  When i add the following maping :
  redirect_address 10.136.236.18 192.168.15.47
 
  the source address for connections to 192.168.15.0/24 is 192.168.25.61
  is there any way i can setup natd and ipfw so that if packets are
  destined for 192.168.15.0/24 then the source address should be
  192.168.15.47
 

 Yes, it is possible...just a pain in the butt.  I am not clear
 exactly what your mean.  If you wish to pursue this, you need to
 send the output of:

 # cat /etc/rc.conf
 # ipfw -a l
 # netstat -rn
 # ps -aux |grep nat


 And any additional nat configuration files or settings.  That
 would greatly improve the chances of your questions getting
 answered.


 Nick Rogness [EMAIL PROTECTED]

I made a typo in the original mail :
=== redirect_address 10.136.236.19 192.167.11.47
should be redirect_address 10.136.236.19 192.168.21.47

configs:

rc.conf:

kern_securelevel_enable=NO
nfs_reserved_port_only=YES
sendmail_enable=NONE
sshd_enable=YES
inetd_enable=NO
portmap_enable=NO
gateway_enable=YES
ntpdate_flags=10.131.156.5
ntpdate_enable=YES
natd_enable=YES
natd_interface=vx0
natd_flags=-config /etc/natd.conf
hostname=nwest-fw.natis.natis
ifconfig_xl0=inet 10.136.236.5  netmask 255.255.255.0
ifconfig_vx0=inet 192.168.28.61 netmask 255.255.240.0
ifconfig_vx0_alias0=inet 192.168.15.57 netmask 255.255.255.0
defaultrouter=10.136.236.1
firewall_enable=YES
firewall_type=natis
firewall_quiet=YES


nwest-fw# ipfw -a l
00050   0 0 divert 8668 ip from any to any via vx0
00100  32  2000 allow ip from any to any via lo0
00200   0 0 deny ip from any to 127.0.0.0/8
00300   0 0 deny ip from 127.0.0.0/8 to any
00400   0 0 check-state
00500   0 0 deny tcp from any to any established
00600   0 0 deny log logamount 256 ip from any to any ipopt ssrr
00700   0 0 deny log logamount 256 ip from any to any ipopt lsrr
00800   0 0 deny ip from 10.136.236.0/24 to any in recv vx0
00900   0 0 deny ip from 192.168.16.0/20 to any in recv xl0
01000   0 0 allow tcp from any to 10.136.236.5 22 keep-state setup
01200   0 0 allow tcp from any to 192.168.28.61 5507 keep-state setup
01300   0 0 allow tcp from any to 192.168.20.47 8080 keep-state setup
01400   0 0 allow tcp from any to 192.168.21.47 5150 keep-state setup
01500   0 0 allow tcp from any to 192.168.15.57 5507 keep-state setup
01600   0 0 allow tcp from any to 10.136.236.18 5507 keep-state setup
01700   0 0 allow tcp from any to 10.136.236.20 8080 keep-state setup
01800   0 0 allow tcp from any to 10.136.236.19 5150 keep-state setup
01900   0 0 deny log logamount 256 tcp from any to any in recv vx0
02000   0 0 deny log logamount 256 icmp from any to any frag
02100   0 0 allow udp from any to any 33434-33443 keep-state
02200   0 0 allow icmp from any to any keep-state icmptype 3,11
02300   0 0 allow icmp from any to any keep-state icmptype 0,8
02400   0 0 allow udp from 10.136.236.5 to 10.131.156.5 123 keep-state
02500   0 0 allow tcp from 10.136.236.5 to 10.131.156.5 5999,80 keep-state
setup
65535   0 0 deny ip from any to any

==

nwest-fw# netstat -rn
Routing tables

Internet:
DestinationGatewayFlagsRefs  Use  Netif Expire
default10.136.236.1   UGSc10xl0
10.10.10/24link#2 UC  10xl0
10.10.10.1 00:c0:df:e3:da:a9  UHLW1  506xl0937
10.136.236/24  link#2 UC  10xl0
10.136.236.1   link#2 UHLW20xl0
127.0.0.1  127.0.0.1  UH  00lo0
192.168.15.57/32   link#1 UC  00vx0
192.168.16/20  link#1 UC  10vx0
192.168.28.61  00:60:97:08:07:d4  UHLW0   16lo0

==

nwest-fw# ps auwx | grep natd
root   152  0.0  0.3  1084  652  p0  S+8:42AM   0:00.00 grep natd
root84  0.0  0.1   448  296  ??  Is8:37AM   0:00.00 /sbin/natd -config
/etc/natd.conf -n vx0


nwest-fw# cat /etc/natd.conf
redirect_address 10.136.236.18 192.168.28.61