Skip to content
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

Test not working #1

Closed
mgrojo opened this issue Dec 9, 2021 · 3 comments
Closed

Test not working #1

mgrojo opened this issue Dec 9, 2021 · 3 comments

Comments

@mgrojo
Copy link
Contributor

mgrojo commented Dec 9, 2021

I tried to test the binding, had to make some changes in order to compile with this configuration:

  • Package: libmosquitto-dev
  • Version: 1.6.9-1
  • Distribution: Ubuntu 20.04.3 LTS
  • gnatgcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

The changes were related to Interfaces.C.Extensions.bool now being a new Boolean instead of a numeric type. (I can provide this changes as a pull request if needed).

The problem is that the test procedure does not print anything. I got this information.

ltrace output:

mosquitto_connect(0x561110b75b70, 0x561110b783b0, 1883, 0)                                           = 3
interfaces__c__strings__free(0x561110b783b0, 0x561110b783b0, 1792, 0)                                = 0
system__secondary_stack__ss_mark(0x7fffdb1df9e0, 0x561110b783b0, 0, 7)                               = 0x7fffdb1df9e0
system__img_int__image_integer(3, 0x7fffdb1df910, 0x56110eec9768, 0x7fffdb1df910)                    = 2
memcpy(0x7fffdb1df880, " 3", 2)                                                                      = 0x7fffdb1df880
system__secondary_stack__ss_allocate(12, 0x3320, 0, 0x3320)                                          = 0x56110eece530
memcpy(0x56110eece538, "3", 1)                                                                       = 0x56110eece538
mosquitto_strerror(3, 0x7fffdb1df881, 0x56110eece530, 51)                                            = 0x7fd612d23c98
interfaces__c__strings__value__3(0x7fd612d23c98, 0x7fffdb1df881, 0x7fd612d23f38, 51)                 = 0x56110eece588
system__concat_4__str_concat_4(0x7fffdb1df950, 0x7fffdb1dfa08, 0x56110eec9772, 0x56110eec9780)       = 0x7fffdb1df954
__gnat_raise_exception(0x56110eece0a0, 0x7fffdb1df950, 0x7fffdb1dfa10, 0x7fffdb1df950)               = 0x561110b756a0
system__secondary_stack__ss_release(0x7fffdb1df9e0, 0x56110eec8619, 0, 0x56110eec8619)               = 0x56110eece4e0
_Unwind_Resume(0x561110b756a0, 0x56110eec8619, 0, 0x56110eec8619 <unfinished ...>
ada__exceptions__triggered_by_abort(0x7fffdb1dfac0, 0x56110eec06cd, 0, 0x56110eec06cd)               = 0x56110eece000

The exception was not visible, but adding a Put_Line shows this:

[3] Invalid function arguments provided.

Any idea about the issue? How could this be debugged further?

@persan
Copy link
Owner

persan commented Dec 10, 2021

Apparently the compiler has moved on, so pleas send the pull request.

@mgrojo
Copy link
Contributor Author

mgrojo commented Dec 10, 2021

OK, PR done.

@mgrojo
Copy link
Contributor Author

mgrojo commented Dec 11, 2021

The error about "Invalid function arguments provided." seems related to eclipse/mosquitto#2117 (comment)

I was able to make it work, setting the keepalive to 30, but then another issue was uncovered in passing this value. The C library expects integer seconds, while the Ada binding passes milliseconds. I'll add this to the pull request.

Another possible change is setting a different default for keepalive, since 0 seems problematic with some mosquitto versions/MQTT implementations. For the moment, I've changed the keepalive value only in the test program.

mgrojo added a commit to mgrojo/mosquitto-ada that referenced this issue Dec 11, 2021
The C library expects integer seconds, while the Ada binding was passing
milliseconds.

Additionally, some versions have problems with a keepalive value of 0, so
the test is using 30, now.

See issue persan#1.
@persan persan closed this as completed Dec 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants