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
buildInvalidMessage hangs, then crashes due to out of memory. #21
Comments
These are the codes that are broken, can you assist @nexdrew? None of them are commented out when things are not working obviously.
I also can't get any help working, even with the uncommented following section. What could be causing this?
The top level help does work. |
Hi, sorry for the radio silence. One thing I see is that you're calling If I get some time I'll try to look a bit further into your code. |
Also note that if you apply configuration like |
Yeah, I thought that was the case with both of those, but in order to get it to work, one starts hacking. I think I have bigger problems. Unless Lines 357-421 above are commented out, the |
Any more tips @nexdrew? |
bump |
@binarymist Apologies, I hadn't given this issue much attention, assuming it was caused by a problem in your code rather than in sywac. But I finally took the time to look into the examples you gave, and I was able to reproduce a bug that showed there was the potential for an infinite loop when generating the help text. See PR #23. What I'd like to do is merge and publish the fix for that problem and then have you retry your code after upgrading sywac to the latest version. If that fixes things for you, then we can close this issue at that time. Hopefully we don't find other issues. 🤞 For future reference, it would help tremendously if you could provide me with a succinct failing test case. It was not easy to pick out which parts of your code snippets were actually relevant. Your debugger screenshots were a big help though. I appreciate you reporting this issue and sending me a bunch of details, but you might have to help me narrow the focus on what the actual problem/failing use-case is. Thanks. |
@binarymist Please give sywac@1.2.1 a try and let me know how it goes. Thanks! |
I'm unable to reproduce the:
I've made a lot of changes since this was reported. Also tested your update and no hang, Re:
You weren't the only one. I thought the very first line of my first comment summed it up:
Although I'm unable to repro the hang, I can't confirm the fix (sadly), but can neither confirm the hang (kind of happily) The second two pieces of code are still not working though, that's the I don't think I'm doing anything wrong, but it's a little tricky to know for sure, as the docs are still fairly sparse, and I've been trying to piece together what sywac expects based on the existing docs and docs from yargs, and varius yargs issues that mostly you have commented on. Is my nesting somehow not what sywac expects? |
Strangly when I try swapping
I'm starting to think that I can not nest commands as seen from L296-L360 like:
As well as:
Can you confirm @nexdrew that this should or not be possible? Usually the prefered option is to answer these sorts of questions by adding to the documentation, thus hopefully those in the future will not try and implement something that is not supposed to be possible at this stage, if that is in-fact a fact. |
Sywac supports nested commands. I can provide you an example tomorrow. In the meantime, could you perhaps give me a simplified version of code you have tried that doesn't work as expected, or maybe point me to a failing example? |
The way you should declare a nested command is by calling |
Ok, so I must be doing something wrong (in the non sywac specific code). I'll create a branch and start ripping code out until either it starts to work, or I have that much simplified version for you. Don't spend any time on it just yet @nexdrew, if it should be working, then it's probably something I'm doing wrong, Let me do this and get back to you. Much appreciated! |
No worries! I'd still like to give you a small working example of nested commands for your reference, but I am AFK right now. I should be able to do this tomorrow morning. |
Ideally throw it in the existing documentaion that you've already so lovingly crafted. |
@binarymist I created a gist with two files that demonstrates a command module with a nested command, based off of the code you referenced above. https://gist.github.com/nexdrew/6c3598ea534aa6788ff1c11d4e3eade5 The code works as I would expect it to. Here are results of sample execution: $ node issue21.js
Usage: issue21 <command> [options]
Commands:
schedule-delivery Launch scheduled mail delivery, max of three days in advance.
Options:
-h, --help Show help [commands: help] [boolean] $ node issue21.js schedule-delivery --help
Usage: issue21 schedule-delivery <command> [options]
Commands:
list List members in order based on latest or oldest mailgunMateScheduledSends datetimes.
Options:
-l, --email-list <email-list> The mailgun email list you would like to
use.
[string] [default: something]
-b, --email-body-file <email-body-file> File containing the html for the body of
the email. Relative to the
emailBodyFileDir directory you set in the
configuration.
[file]
-f, --from <sent-from-for-replies> The value that the receiver will see that
your emails appear to be sent from, in
the form of "Kim
<services@binarymist.net>"
[string]
-s, --subject <subject-for-email> The subject for the email
[string]
-t, --schedule-time <time-to-schedule-email-send-for> The time that all emails will be sent (in
RFC 2822 time).
[mailgunDateTimeFormat]
-tm, --test-mode Whether or not to send in test mode
"o:testmode".
[boolean]
-h, --help Show help
[commands: help] [boolean] $ node issue21.js schedule-delivery list -h
Usage: issue21 schedule-delivery list [options]
Options:
-o, --order [des|asc(default)] The order you would like the items
displayed in.
[string] [default: asc]
-l, --email-list <email-list> The mailgun email list you would like to
use.
[string] [default: something]
-b, --email-body-file <email-body-file> File containing the html for the body of
the email. Relative to the
emailBodyFileDir directory you set in the
configuration.
[file]
-f, --from <sent-from-for-replies> The value that the receiver will see that
your emails appear to be sent from, in
the form of "Kim
<services@binarymist.net>"
[string]
-s, --subject <subject-for-email> The subject for the email
[string]
-t, --schedule-time <time-to-schedule-email-send-for> The time that all emails will be sent (in
RFC 2822 time).
[mailgunDateTimeFormat]
-tm, --test-mode Whether or not to send in test mode
"o:testmode".
[boolean]
-h, --help Show help
[commands: help] [boolean] $ node issue21.js schedule-delivery -t bad
Usage: issue21 schedule-delivery <command> [options]
Commands:
list List members in order based on latest or oldest mailgunMateScheduledSends datetimes.
Options:
-l, --email-list <email-list> The mailgun email list you would like to
use.
[string] [default: something]
-b, --email-body-file <email-body-file> File containing the html for the body of
the email. Relative to the
emailBodyFileDir directory you set in the
configuration.
[file]
-f, --from <sent-from-for-replies> The value that the receiver will see that
your emails appear to be sent from, in
the form of "Kim
<services@binarymist.net>"
[string]
-s, --subject <subject-for-email> The subject for the email
[string]
-t, --schedule-time <time-to-schedule-email-send-for> The time that all emails will be sent (in
RFC 2822 time).
[mailgunDateTimeFormat]
-tm, --test-mode Whether or not to send in test mode
"o:testmode".
[boolean]
-h, --help Show help
[commands: help] [boolean]
Value "bad" is invalid for argument t or schedule-time. Please specify a valid schedule datetime. The datetime you entered was not valid according to mailgun's rules. RFC 2822, formatted as mailgun requires "YYYY-MM-DD", See (https://documentation.mailgun.com/en/latest/user_manual.html#scheduling-delivery) for more information. Please try again. $ node issue21.js schedule-delivery
schedule-delivery: { _: [],
h: false,
help: false,
l: 'something',
'email-list': 'something',
b: undefined,
'email-body-file': undefined,
f: undefined,
from: undefined,
s: undefined,
subject: undefined,
t: undefined,
'schedule-time': undefined,
tm: false,
'test-mode': false } $ node issue21.js schedule-delivery list
list: { _: [],
h: false,
help: false,
l: 'something',
'email-list': 'something',
b: undefined,
'email-body-file': undefined,
f: undefined,
from: undefined,
s: undefined,
subject: undefined,
t: undefined,
'schedule-time': undefined,
tm: false,
'test-mode': false,
o: 'asc',
order: 'asc' } $ node issue21.js schedule-delivery list -o desc
list: { o: 'desc',
_: [],
h: false,
help: false,
l: 'something',
'email-list': 'something',
b: undefined,
'email-body-file': undefined,
f: undefined,
from: undefined,
s: undefined,
subject: undefined,
t: undefined,
'schedule-time': undefined,
tm: false,
'test-mode': false,
order: 'desc' } Please note the inline comments in the gist code. Also, here are some things I wanted to mention:
|
Thanks muchly for that @nexdrew, some crucial points in there that I had missed or wasn't aware of. I didn't realise
I wasn't aware of this, again, did I fail to read this in the docs or does it not exist, or maybe needs clearer explanation? After realising this, I realised my I also replaced the optional |
Any feedback @nexdrew |
Docs are definitely lacking at the moment. Otherwise, can we close this issue? |
When
buildInvalidMessage
returns, execution hangs for about 20 seconds. Then:Also
setValue
is executed for multiple types.The text was updated successfully, but these errors were encountered: