New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'%include ***.sas /source2' crashes the session. when the included file has another enconding with session encoding #266
Comments
so, that file contains only the following line?
And how are you 'changing the encoding of the file'? I'd like to try to reproduce this, but there's nothing in those characters that would be anything than their single byte ASCII values in latiin1, wlatin1, utf-8, or shift-jis, so I'm confused at how you say the file is encoded, and how you change the encoding? I have seen that the IOM client will crash when it get's 0x00 bytes streamed to it from SAS for things it expects to come through as stings. I'm disappointed by that, and I have made some changes in my use of it in some cases to do my own binary streaming for cases I can. I don't know if this is what is happening or not, that's why I'd like to reproduce it here. I should be able to start up an IOM server running shift-jis, but I'm not really sure about this file you're including. Thanks, |
Hi @tomweber-sas, I misunderstood what lead to the error. I'm really sorry. I will upload sample files anywhere. |
Both files include Japanese characters utf8.sas -> fail sjis.sas -> work
Hi I uploaded 2 files. Also note that I controlled encoding to be used by VS code. |
Ok, that certainly makes more sense. I'll see if I can reproduce this on my side. I am expecting I will be able to, and that it may even be that issue I mentioned with the IOM client, but I'll need to prove that either way and see what I can do; that's just speculation on my part so fat. Thanks for the updated data! |
Just a quick update. I've been busy on these other issues. But, I was just able reproduce this here, so I'll be debugging it tomorrow to see what I see. Hopefully there's a way for me to fix this in some code of mine somehow; that would be ideal :). More tomorrow ... |
@kjnh10 I have a fix for this! It's at master. It's the saspyiom.jar file, so if you can pull from master, just be sure you're classpath is pointing to this new jar. I was able to catch the transcoding error down in the orb stuff and recover from it. I can't get he log itself as that failed, but I get an error message and am able to continue work w/ saspy with no problems after that. See how it works for you. Here's a view of it on my system. I was getting the same connection reset, SAS terminated error when submitting it before the fix. |
Thanks, I confirmed that a session does not crash when importing utf-8 code! But the fact that I can't import the file by transcoding error remains though SAS Enterprise guide can handle. Do you have any thoughts why SAS Enterprise guide can handle utf-8 file? |
Great, thanks for confirming that. What are you actually getting when submitting the utf8 file? |
Hi @tomweber-sas , Thanks for comfirming. In my environment, same as your environment. I'm gettig feeling that saspy has the same behavior though it does output reading log errors. |
Sorry, Please wait for a while. |
Actually, I believe I'm seeing what you said. I added a couple data steps so I could see if they were executed or not. They were. On the SAS server, it's not causing any real problem; the other things being submitted still run. But the log, with whatever that was, never shows up as it's getting transcode errors in the IOM client side. At least that's what I'm seeing in saspy. Can only assume it's the same issue for EG. Running the following only shows the first data step in the log, though both tables a, b were created. Nothing else shows up in the log. EG:
Log:
And, with saspy, the same:
So, I think the behavior is the same, except I return the error about the log being messed up while EG just ignores it and you don't notice part of the log is missing. As the transcoding is taking place in the IOM client code, I don't have the buffer with the log in it to even try to return or the option to replace non-translatable characters with the replacement char or anything else. I just don't get that part of the log. Thanks, |
So, I've been playing with a little more and what is different is that in the EG log, you actually see the first data step (along with the other boiler plate generated code). But none of the rest of the log past the error. I've been able to get saspy to return most of the log before and after the error. Though I've done this by reducing the size of the buffer I use to read the log. I was reading the whole log each time, which is why you got nothing except for the error. I've shrunk the buffer down to 32 chars, smaller than I would really want to go but just to see, and I get all of the log, except the 32 chars worth that contained the bytes that weren't able to be transcoded. So, I need to pick a buffer size between small enough to not loose a significant amount of information for this particular situation, and large enough as to not be a performance issue for every other usual case that never has this happen. Here's the parts of the log where the missing section is, with the 32 byte buffer; everything before and after is complete in both cases: No error; shift-jis data
error; utf8 data
What are your thoughts? |
@tomweber-sas Thanks, |
Cool. I've pushed it to master. This changed saspyiom.jar, so be sure when you pull, that your classpath for this jar is pointing the the new one from master. If you're pointing to the install, then you're good. Also, I can't bring myself to set the buffer, for getting the log, to 32 bytes; I want to get the log in 1 call, not 10s, 100s, Ks ... So, I still have a large default size so as to not cause any performance issue. Again, this isn't the 99% use case. So, first is that this no longer abends, you see the error message about the transcoding error:
and it keeps running fine. Depending upon what was submitted, you may get some amount of log before and after (context) the error message, though maybe none. I've added an configuration definition option for this access method so you can control the size of the log buffer; logbufsz=
32 is the smallest you can set, and you'll get all the context I can give you. Like in the post a few above. You can set it low and run like that all the time; generally, the log isn't so large that you would actually notice. Or, if you ever see this error, you can then just try that again after setting it low on a new SAssession. I'm glad you posted this problem here, since now, it's fixed and is working better than I would have expected; you can now get (most) all of the log, and an error message so you know something happened. So that better then EG? :) :) I'll get this documented too, for the next release when I create it. But you should be good with it from master. Let me know if it works as you expect at your site with your cases! Thanks, |
@tomweber-sas Thanks as always. |
I aim to please :) And, actually, I think I just got the last issue I've been working on, along with this and others from the past 2 weeks, resolved, So, once I get that finalized, and update the doc, tested ... I will be building a new release - V3.1.7. That will contain this fix and the others, so then you'll have this in the latest production version. Thanks again! |
This is now available in the current production release - 3.1.7. I'll close this now, but let me know if there's anything else! Thanks! |
Describe the bug
'%include ***.sas /source2' crashes the session when the included file has another encoding with te session encoding
reproduce.py
utf8.sas
/* comment only file. saved with utf8. even does not include special characters */
If I change the encoding of the included file to shift-jis, this code works.
Just note: SAS Enterprise guide can handle '%include "/****/utf8.sas" /SOURCE2;' even though the session encoding is shift-jis (SAS server is same)
To Reproduce
See above
Expected behavior
this works fine.
Screenshots
None
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: