Process in parallel and output result to stdout theread-safely
Dr.No
jckj33 at gmail.com
Mon Sep 10 20:30:52 UTC 2018
On Saturday, 8 September 2018 at 14:26:45 UTC, ag0aep6g wrote:
> On 09/03/2018 08:13 PM, Dr.No wrote:
>> But it in the middle of output, I got output like this:
>>
>>> outjson = {"barCode":"XXXX20","ade":"20"}♪◙outjson =
>>> {"barCode":"XXXXX21","ade":"21"}
>>
>> also there's that extra ♪◙ character. Thos sounds memory
>> violation somewhere.
>> This only happens when using parallel. Any guess what's
>> possibily happeing?
>
> If that only ever happens at line breaks, then that doesn't
> necessarily look like memory corruption to me.
Yes, it does only happens at line breaks. I hadn't realized that
until you mentioned. It does gets in place of \r and \n, that's
why there's all in one line when this happens. Thankfor for the
notice.
> I looked around a bit and found code page 437 [1]. It has those
> characters at 0xD and 0xA which is where ASCII has \r and \n.
> So it might be that code page 437 is used when displaying that
> particular entry. Why that would happen, I have no idea.
So I guessed that something changed the console code page. I've
tried to call call chcp 65001 at program's start up. Not worked.
Tried inside the main loop. Also not worked.
> To get better help, you should post a complete test case that
> people can just copy/paste. That includes imports, a `main`
> function, and the command you use to compile. Also add
> information about your environment (OS, compiler version).
>
I made a reduced version where you can do just dmd -run hello.d.
The application does convert alot of PDF files to text then do
some parsing (I've removed this not needed part). In my code, at
iteration 28 I got those character (♪◙), which is the error. I
hope you can reproduce this error on your machine as well. I got
some PDF files and duplicated them just for testing purpose. If
for some reason you didn't get the same error immediately, try
duplicate the PDFs and try again. I believe this can reproduce
the erro.
Here's the resources to compile the application:
source code: https://pastebin.com/RwrUikQS
PDF files + pdf to text application:
https://drive.google.com/file/d/1uKjJX4pQIEWVK4vujUsm0ln2yHS7z5ZZ/view?usp=sharing
OS: Windows 10 64-bit
compiler: DMD32 D Compiler v2.080.0 (same issue happens on ldc)
command line: dmd -run hello.d
Thank you very much for your time.
More information about the Digitalmars-d-learn
mailing list