FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mango Logging

 
Post new topic   Reply to topic     Forum Index -> DDL - D Dynamic Libraries
View previous topic :: View next topic  
Author Message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Thu Mar 23, 2006 1:22 pm    Post subject: Mango Logging Reply with quote

Hi Eric;

I gather you've run into some issues with logging to the console? Can you relate what happens? I know there's an issue with the Win32 api, to do with passing very large buffers to it (> 32KB). Yet, that shouldn't be a problem since the time when Unicode support was added ...

- Kris
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Thu Mar 23, 2006 2:09 pm    Post subject: Reply with quote

Hey, here's what I know about the problem:

Code:
Not enough storage is available to process this command.

This translates to system error #8 (ERROR_NOT_ENOUGH_MEMORY), as obtained by a call to getLastError()... somewhere.

Well I've done my best to narrow it down, and so far the effect is quite deterministic, but it only happens when I run the application in the command prompt. If I pipe the output directly to a file, this doesn't happen. (could windows be generating a larger set-aside buffer for output when a pipe is used, as opposed to the console window?)

This happens when I dump certain OMFBinary instances via toString() (specifically, one embedded within phobos.lib):
Code:
Stdout.println("binary: ?s",binary.toString);

I know this ecause the 'binary: ' portion of the string manages to display, but is immediately followed by the error message (above). The program halts at that point.

Code:
binary: Error: Not enough storage is available to process this command.


One last thing, my console is typically configured as follows:
Code:
mode con: lines=999 cols=120

... I can't say if that's a variable here or not.

I'll let you know if I can come up with anything else.
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Thu Mar 23, 2006 3:27 pm    Post subject: Reply with quote

Egad!

I'm looking at the code, and it's certainly possible to send more than 32K characters to WriteConsole at one time ~ I imagine that's the problem, having seem a similar thing about a year ago.

The redirect operates correctly because it sidesteps WriteConsole, and does a WriteFile instead.

I'll get a patch out to you soon;


- Kris
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Thu Mar 23, 2006 4:12 pm    Post subject: Reply with quote

I just checked-in a change to mango.io.Console, which should manage the amount of data sent to WriteConsole (on line 297). Haven't tried it yet, but I think it should be OK. If you get the same error, try changing the 32767 to something smaller (like 16384)

The concern I have with this 'fix' is the potential for splitting a UTF16 surrogate-pair; chunking the output in a simplistic manner may not work for all cases, yet it's a royal pain to start checking all that when the overwhelming majority of cases won't trip. Still, the WriteConsole function sucks for tossing an error instead of clipping and returning what it could emit instead (which it already does in general).

edit: just added a check for surrogate-pairs too
Back to top
View user's profile Send private message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Fri Mar 24, 2006 8:26 am    Post subject: Reply with quote

Kris, thanks for the assist. On my next pass, I'll be adding these improvements in. Hopefully, this will stomp out the bug. Smile
_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DDL - D Dynamic Libraries All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group