> IIRC the new Ruby runtime (2.0) has real threads.
Ruby 1.9 and above uses kernel threads rather than green threads, but it
still has a global interpreter lock that keeps ruby code from executing
concurrently. Sometimes things like C extensions can, and, of course, I/O
can. As someone mentioned,
> So what's the concenus here?
There probably won't be any.
I say: get your XMPPD correct and properly tested first. You designed
it single threaded anyway, so there's no point in changing that now.
Once you feel you want threads for some reason, you'll at least have
tests to back up your refacto
On Fri, Oct 3, 2008 at 8:29 AM, Jonathan Dickinson
<[EMAIL PROTECTED]> wrote:
>> ... Only resort to
>> threads when you *really* have a problem that can only be solved with
>> adding threads.
>
> Amen.
>
>> Otherwise, stay away from it if you want to maintain
>> your sanity.
>
> Amen, again.
>
>> I
Am 03.10.2008 um 13:48 schrieb Eric Will:
Like I said, I don't really know anything about threading. From what I
understand, doing a blocking read() call in a Ruby thread is going to
block the entire program anyway, because Ruby doesn't do "real"
threads.
Ruby doesn't use real threads, that's
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Remko Tronçon
> Sent: Friday, October 03, 2008 2:24 PM
> To: Jabber/XMPP software development list
> Subject: Re: [jdev] parsing xml (xmpp) with ruby
>
> ... Only resort to
&g
> threading is really a must know these days.
Threading isn't more a 'must' than it was before. Only resort to
threads when you *really* have a problem that can only be solved with
adding threads. Otherwise, stay away from it if you want to maintain
your sanity. I doubt that the poster's software
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Eric Will
> Sent: Friday, October 03, 2008 1:49 PM
> To: Jabber/XMPP software development list
> Subject: Re: [jdev] parsing xml (xmpp) with ruby
>
> ...
>
> Like I said
On Thu, Oct 2, 2008 at 5:41 PM, Stephan Maka <[EMAIL PROTECTED]> wrote:
> Oh, I didn't know that. I now realize that you are using no threads.
> Obviously REXML's sax2parser is an endless loop which only breaks on EOF
> and loses all state then.
>
> There are three solutions:
> * Either use threads
M
> To: Jabber/XMPP software development list
> Subject: Re: [jdev] parsing xml (xmpp) with ruby
>
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> > Behalf Of Eric Will
> > Sent: Thursday, October 02, 2008 6:26 PM
> > To: Ja
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Eric Will
> Sent: Thursday, October 02, 2008 6:26 PM
> To: Jabber/XMPP software development list
> Subject: Re: [jdev] parsing xml (xmpp) with ruby
>
> ... I don't know w
Eric Will wrote:
> > I'd be happy to repair your code if you finally shared it.
>
> The code has been at http://svn.malkier.net/xmppd/ for two years.
>
> If you can figure it out, thanks. The parsing is in
> lib/xmppd/xmpp/parser.rb and lib/xmppd/xmpp/stream.rb
Oh, I didn't know that. I now real
On Wed, Oct 1, 2008 at 5:42 PM, Stephan Maka <[EMAIL PROTECTED]> wrote:
> The parsers are fine. However, staying with one parser and keeping your
> own state per-stream is wrong. Keep one push parser per stream and let
> it care about the stream's state. Then just build the DOM with SAX
> events co
nd, so there were not that many to start with).
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Jonathan Dickinson
> Sent: Thursday, October 02, 2008 12:09 PM
> To: Jabber/XMPP software development list
> Subject: Re: [jdev] parsing
10:04 PM
> To: Jabber/XMPP software development list
> Subject: Re: [jdev] parsing xml (xmpp) with ruby
>
> On Wed, Oct 1, 2008 at 3:59 PM, Remko Tronçon <[EMAIL PROTECTED]>
> wrote:
> > I don't know anything about REXML. Looking at the source code,
> there's
>
Remko Tronçon wrote:
> > The problem of receiving a half-stanza that's not well formed is still
> > here.
>
> To me, this means that you haven't solved the problem correctly, and
> that you're still using the wrong type of parser that expects your
> document to be complete. A real incremental pars
On Wed, Oct 1, 2008 at 3:59 PM, Remko Tronçon <[EMAIL PROTECTED]> wrote:
> I don't know anything about REXML. Looking at the source code, there's
> a bunch of parsers, but all of them call 'pull' somewhere, so that
> makes me suspect that something's not right. The only people that can
> help you a
Remko Tronçon wrote:
>> I've run out of XML parsers to use. What do you use? Ruby's REXML
>> SAX2Parser raises an exception on malformed XML.
>
> I don't know anything about REXML. Looking at the source code, there's
> a bunch of parsers, but all of them call 'pull' somewhere, so that
> makes me s
> I've run out of XML parsers to use. What do you use? Ruby's REXML
> SAX2Parser raises an exception on malformed XML.
I don't know anything about REXML. Looking at the source code, there's
a bunch of parsers, but all of them call 'pull' somewhere, so that
makes me suspect that something's not rig
> If someone is manually sending XML, and never sends an end tag, it will
> keep on adding to the buffer forever. What should I do about this? Set
> a limit on the buffer? If I limit my read()s to 8192 bytes, should I
That's a server limit you have to pick. I don't really see what that
limit would
On Wed, Oct 1, 2008 at 3:00 PM, Remko Tronçon <[EMAIL PROTECTED]> wrote:
> That's a server limit you have to pick. I don't really see what that
> limit would have to do with the read() buffer size, it's completely
> independent.
My correlation was that the max buffer size could be a certain number
On Wed, Oct 1, 2008 at 11:49 AM, Michal 'vorner' Vaner <[EMAIL PROTECTED]>
wrote:
> You don't get it. Sax does not need to load the whole document in
> memory. But it needs some information from the parent nodes (like depth,
> namespace declarations, etc). You can't start parsing from the middle.
Hello
On Wed, Oct 01, 2008 at 11:33:44AM -0400, Eric Will wrote:
> On Wed, Oct 1, 2008 at 11:15 AM, Michal 'vorner' Vaner <[EMAIL PROTECTED]>
> wrote:
>
> > If you take and put it into
> > first parser and then to second and
> > into another, then you get mess and not data. Or do you
> > reus
> I'm using a SAX parser. It doesn't care about the structure of the
> overall document. I build the nodes by myself, a tag at a time.
That doesn't really make much sense. Parsing
...
in one pass, and parsing
and then
is something entirely different (foo will have a different namespa
On Wed, Oct 1, 2008 at 11:15 AM, Michal 'vorner' Vaner <[EMAIL PROTECTED]>
wrote:
> If you take and put it into
> first parser and then to second and
> into another, then you get mess and not data. Or do you
> reuse it in some other way I do not get?
I'm using a SAX parser. It doesn't care ab
Hello
On Wed, Oct 01, 2008 at 11:04:11AM -0400, Eric Will wrote:
> On Wed, Oct 1, 2008 at 8:21 AM, Michal 'vorner' Vaner <[EMAIL PROTECTED]>
> wrote:
> > You can not use a new parser every time. You need it to know the
> > beginning of the stream.
>
> Why? It works fine without knowing it. How c
On Wed, Oct 1, 2008 at 8:21 AM, Michal 'vorner' Vaner <[EMAIL PROTECTED]> wrote:
> You can not use a new parser every time. You need it to know the
> beginning of the stream.
Why? It works fine without knowing it. How can I reuse the same parser
when the source changes?
That is, I have to do pars
Hello
On Wed, Oct 01, 2008 at 07:50:26AM -0400, Eric Will wrote:
> On Tue, Sep 30, 2008 at 6:22 PM, Lucas Nussbaum
> <[EMAIL PROTECTED]> wrote:
> > We don't deal with it, REXML does it for us by not pushing incomplete
> > events to us through the SAX2Parser.
>
> I guess this is because you guys u
On Tue, Sep 30, 2008 at 6:22 PM, Lucas Nussbaum
<[EMAIL PROTECTED]> wrote:
> We don't deal with it, REXML does it for us by not pushing incomplete
> events to us through the SAX2Parser.
I guess this is because you guys use it attached to a socket? I don't
do that. I read from the socket and pass t
(Please Cc me, I don't follow jdev very closely)
On 30/09/08 at 09:30 -0400, Eric Will wrote:
> On Mon, Sep 29, 2008 at 10:55 PM, Eric Will <[EMAIL PROTECTED]> wrote:
> > Okay, I implemented a SAX parser. It now goes through the tags until it gets
> > to a partial one, and then raises an exception
2008 2:40 AM
> To: jdev@jabber.org
> Subject: Re: [jdev] parsing xml (xmpp) with ruby
>
> Eric Will wrote:
> > It doesn't complain about a partial file. If I pass it a partial
> > stanza, with say the end tag only halfway finished, like " > raises an exception.
Eric Will wrote:
> It doesn't complain about a partial file. If I pass it a partial
> stanza, with say the end tag only halfway finished, like " raises an exception. The exception tells me nothing that I can use to
> isolate the incomplete stanza and save it to be appended onto later.
>
> I feed i
Hello
On Tue, Sep 30, 2008 at 11:42:13AM -0400, Eric Will wrote:
> On Tue, Sep 30, 2008 at 9:57 AM, Remko Tronçon <[EMAIL PROTECTED]> wrote:
> > Hmm, how can a SAX parser complain about a partial XML file? SAX *is*
> > incremental. It would probably help if you described in a high level
> > how yo
On Tue, Sep 30, 2008 at 9:57 AM, Remko Tronçon <[EMAIL PROTECTED]> wrote:
> Hmm, how can a SAX parser complain about a partial XML file? SAX *is*
> incremental. It would probably help if you described in a high level
> how your parser works, how you feed it data, ...
It doesn't complain about a pa
> Okay, I implemented a SAX parser. It now goes through the tags until
> it gets to a partial one, and then raises an exception. The exception
> gives me zero information that I can use to cache the incomplete tag.
Hmm, how can a SAX parser complain about a partial XML file? SAX *is*
incremental.
On Mon, Sep 29, 2008 at 10:55 PM, Eric Will <[EMAIL PROTECTED]> wrote:
> Okay, I implemented a SAX parser. It now goes through the tags until it gets
> to a partial one, and then raises an exception. The exception gives me zero
> information that I can use to cache the incomplete tag. REXML sucks.
Okay, I implemented a SAX parser. It now goes through the tags until
it gets to a partial one, and then raises an exception. The exception
gives me zero information that I can use to cache the incomplete tag.
REXML sucks.
Kind of stuck at the moment.
_
> and then do all this mumbo jumbo in Ruby, it's
> going to cost me in terms of performance pretty badly.
I guess that's one of the prices you pay for using ruby. And you'll
probably pay more ;-) If it really hurts you (which you'll only be
able to tell when your server runs on a decent load), may
Andreas Monitzer wrote:
> On Sep 29, 2008, at 17:44, Eric Will wrote:
>
>> My question is this: how often could this happen, TODAY? In all the
>> years I wrote IRC programs, I can't recall EVER getting a partial-
>> line, and in my two years of messing with XMPP, I can't recall EVER
>> getting a b
On Sep 29, 2008, at 17:44, Eric Will wrote:
> My question is this: how often could this happen, TODAY? In all the
> years I wrote IRC programs, I can't recall EVER getting a partial-
> line, and in my two years of messing with XMPP, I can't recall EVER
> getting a broken stanza.
Don't forget that
On Monday 29 September 2008 00:29:18 Michal 'vorner' Vaner wrote:
> Hello
>
> On Mon, Sep 29, 2008 at 09:19:17AM +0200, Remko Tronçon wrote:
> > > I tried to create my own XMPP parser/library (for, ehm, educational
> > > purposes). I never come across this issue. As far as I understand it, I
> > >
Hello
On Mon, Sep 29, 2008 at 11:44:52AM -0400, Eric Will wrote:
> My question is this: how often could this happen, TODAY? In all the
> years I wrote IRC programs, I can't recall EVER getting a partial-
> line, and in my two years of messing with XMPP, I can't recall EVER
> getting a broken
Eric Will wrote:
> There is no simple way to reason out when a stanza has ended. The
> way everyone seems to use is "use a SAX parser, then make a DOM out
> of that" which, to me, sucks.
You do not need a real DOM with parent and stuff like that. I parse
the stanza from a SAX parser into a simple
My main problem isn't the TLS (I'm the server, so I don't have to
worry about it since I send the initial binary), but how to figure out
when I've read()'d a complete stanza. In IRC I can read and read and
read until I get a "\n", but that's not the case in XMPP. There is no
simple way to r
On Mon, Sep 29, 2008 at 9:19 AM, Remko Tronçon <[EMAIL PROTECTED]> wrote:
> > I tried to create my own XMPP parser/library (for, ehm, educational
> > purposes). I never come across this issue. As far as I understand it, I
> > get proceed, but no more binary data.
>
> You mean you don't get binary
Hello
On Mon, Sep 29, 2008 at 09:19:17AM +0200, Remko Tronçon wrote:
> > I tried to create my own XMPP parser/library (for, ehm, educational
> > purposes). I never come across this issue. As far as I understand it, I
> > get proceed, but no more binary data.
>
> You mean you don't get binary data
> I tried to create my own XMPP parser/library (for, ehm, educational
> purposes). I never come across this issue. As far as I understand it, I
> get proceed, but no more binary data.
You mean you don't get binary data when you did a read() of
? You can't rely on that on a TCP connection.
cheers,
Hello
On Sun, Sep 28, 2008 at 11:42:56PM -0700, Justin Karneges wrote:
> On Sunday 28 September 2008 21:52:49 jlist wrote:
> 2) Don't send TLS bytes into your SAX parser. When you receive
> [binary data], then you want to make sure that [binary data] isn't
> SAX-parsed. Unless your parser allo
On Sunday 28 September 2008 21:52:49 jlist wrote:
> In the case of a TLS connection, there's also the switch
> from plain text to TLS...
>
> I'm also coming to think that the best (or easiest) way
> could be to use a SAX parser to parse out the stanzas, then
> use a DOM parser for easy access to th
> However, this may not handle the TLS's case though. I haven't looked
> into the details but I suspect I need to handcraft the SAX
> parser for the tags just to handle this scenario.
A common way of avoiding to write your own SAX parser is to hand it
only chunks that are known to come before TLS
I also find XMPP particularly difficult to parse.
In the case of a TLS connection, there's also the switch
from plain text to TLS...
I'm also coming to think that the best (or easiest) way
could be to use a SAX parser to parse out the stanzas, then
use a DOM parser for easy access to the attribut
> I was actually thinking very seriously of doing this.
That's what many clients do.
cheers,
Remko
___
JDev mailing list
FAQ: http://www.jabber.org/discussion-lists/jdev-faq
Forum: http://www.jabberforum.org/forumdisplay.php?f=20
Info: http://mail.jabbe
Eric Will wrote:
> [...] I don't want to have to write a complicated class to, in effect,
> parse the XML myself when the XML parser should be doing this for me.
You could use XMPP4R's Stream & StreamParser classes. These indeed use
SAX to build DOM trees for each stanza.
Stephan
___
On Sat, Sep 27, 2008 at 5:06 PM, Norman Rasmussen
<[EMAIL PROTECTED]> wrote:
> If I ever had to write my own xmpp parser, I would use a SAX like parser to
> isolate the elements from the input stream, so I knew that they were well
> formed, and then I would put them into a fake XML document using t
On Sat, Sep 27, 2008 at 9:28 PM, Eric Will <[EMAIL PROTECTED]> wrote:
> [...] I have to wrap every
> incoming chunk of XMPP with my own tag, and then ignore that
> after REXML parses it. I am currently unhappy with this approach.
>
What happens in the incoming data chunk isn't well formed XML, d
Hello World,
I am writing an XMPP (Jabber) server in Ruby. XMPP uses XML for its
protocol. This means I have to do a good deal of XML parsing, in Ruby.
Right now I am using REXML to parse the individual stanzas as they
come in. However, in order to do this without REXML complaining of
"multiple r
55 matches
Mail list logo