RE: UDF writing to unix socket - segfaults?

2012-08-08 Thread Per Jessen
Martin Gainty wrote:

> this is pure speculation unless we can get ahold of the source code
> for your specific version of glibc and determine what the maximum
> sizes are .. otherwise anything I suggest would be speculative..lets
> take a look at
>
http://fossies.org/dox/glibc-2.16.0/sysdeps_2mach_2hurd_2sendto_8c_source.html
> 
> ssize_t
>29 __sendto (int fd,
>30   const void *buf,
>31   size_t n,
>32   int flags,
>33   const struct sockaddr_un *addr,
>34   socklen_t addr_len)
> Here his maximum buffer length for sending is unsigned int
> specifically size_t so..
> are both send and receive entities IPv4 or both entities are IPv6
> if thats the case..
> can you send
> 0 Bytes
> 2 bytes
> 4 bytes
> 8 bytes
> at what maximum length of buffer does the segfault occur
> ?

Interesting that you should pick on the length - I think that might be
it.  When I switched to using a UDP socket, sendto() did complain about
the length.  (error 90, message too long).  Hmm, that's probably a UDP
packet-size restriction, whereas no such restriction exist for a unix
socket (I presume).  Thanks for the idea!


-- 
Per Jessen, Zürich (24.4°C)


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



RE: UDF writing to unix socket - segfaults?

2012-08-08 Thread Martin Gainty

this is pure speculation unless we can get ahold of the source code for your 
specific version of glibc and determine what the maximum sizes are ..
otherwise anything I suggest would be speculative..lets take a look at
http://fossies.org/dox/glibc-2.16.0/sysdeps_2mach_2hurd_2sendto_8c_source.html

ssize_t
   29 __sendto (int fd,
   30   const void *buf,
   31   size_t n,
   32   int flags,
   33   const struct sockaddr_un *addr,
   34   socklen_t addr_len)
Here his maximum buffer length for sending is unsigned int specifically size_t
so..
are both send and receive entities IPv4 or both entities are IPv6
if thats the case..
can you send 
0 Bytes
2 bytes
4 bytes
8 bytes
at what maximum length of buffer does the segfault occur
?

Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.


> From: p...@computer.org
> Subject: RE: UDF writing to unix socket - segfaults?
> Date: Wed, 8 Aug 2012 15:39:09 +0200
> To: mysql@lists.mysql.com
> 
> Martin Gainty wrote:
> 
> > assuming you worked out the access to network by your code permissions
> 
> When I open the unix socket, I give it 0777.
> 
> > that means memory heap or stack is being overrun...you would be well
> > advised to download the connect() and sendto() code from the OS vendor
> 
> I'm running on Linux, so that is glibc - they work fine in a lot of
> other code. I find it hard to suspect those two. 
> 
> 
> /Per
> 
> -- 
> Per Jessen, Zürich (23.0°C)
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:http://lists.mysql.com/mysql
> 
  

RE: UDF writing to unix socket - segfaults?

2012-08-08 Thread Per Jessen
Martin Gainty wrote:

> assuming you worked out the access to network by your code permissions

When I open the unix socket, I give it 0777.

> that means memory heap or stack is being overrun...you would be well
> advised to download the connect() and sendto() code from the OS vendor

I'm running on Linux, so that is glibc - they work fine in a lot of
other code. I find it hard to suspect those two. 


/Per

-- 
Per Jessen, Zürich (23.0°C)


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



RE: UDF writing to unix socket - segfaults?

2012-08-08 Thread Martin Gainty

assuming you worked out the access to network by your code permissions

that means memory heap or stack is being overrun...you would be well advised to 
download the connect() and sendto() code from the OS vendor and toss in plenty 
of codeguard and
debug statements and recompile and rebuild.

Mit Fruendlichen Grüßen
Martin 
(12.2°C)
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.


> From: p...@computer.org
> Subject: UDF writing to unix socket - segfaults?
> Date: Wed, 8 Aug 2012 08:26:23 +0200
> To: mysql@lists.mysql.com
> 
> I am writing a UDF for sending messages to a local daemon. I've been
> trying to make it use a UNIX socket, but it keeps segfaulting on
> connect() or sendto().  I have double and tripled checked everything,
> but I'm not finding anything. 
> 
> After a day or two, I finally decided to switch to UDP and writing to
> localhost instead, which works fine.  I still feel writing to a UNIX
> socket ought to work and even if I've got a permission issue or
> similar, a segfault is not the appropriate handling. Any clues?
> 
> 
> -- 
> Per Jessen, Zürich (16.5°C)
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:http://lists.mysql.com/mysql
> 
  

UDF writing to unix socket - segfaults?

2012-08-07 Thread Per Jessen
I am writing a UDF for sending messages to a local daemon. I've been
trying to make it use a UNIX socket, but it keeps segfaulting on
connect() or sendto().  I have double and tripled checked everything,
but I'm not finding anything. 

After a day or two, I finally decided to switch to UDP and writing to
localhost instead, which works fine.  I still feel writing to a UNIX
socket ought to work and even if I've got a permission issue or
similar, a segfault is not the appropriate handling. Any clues?


-- 
Per Jessen, Zürich (16.5°C)


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql