| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…nd swift-client libraries
|
I used these libraries as a baseline to access swift/keystone:
I'd love to have some feedback on how I integrated it into mapcache. Currently this functionality is not really tested in production, so this PR stays a draft. keystone-client uses json-c (added as cmake dependency), I'm not sure if this is done correctly. I'm aware, that mapcache ships with its own JSON implementation (cJSON), but I did not yet make an effort to replace either. |
Sorry, something went wrong.
There was a problem hiding this comment.
Not going into the actual swift logic, here are a few comments. The error checking and connection pool releasing applies to the whole cache_swift.c file, not just the reviewed lines.
Sorry, something went wrong.
| @@ -0,0 +1,200 @@ | |||
| #ifndef KEYSTONE_CLIENT_H_ | |||
There was a problem hiding this comment.
Missing licence on imported files
Sorry, something went wrong.
There was a problem hiding this comment.
Right!
Besides: Do you think that it is alright to include a source file like that? The repo says it is GPL v3.
Sorry, something went wrong.
|
|
||
| keystone_err = keystone_authenticate(conn->keystone_context, cache->auth_url, cache->tenant, cache->username, cache->password); | ||
| if (keystone_err != KSERR_SUCCESS) { | ||
| ctx->set_error(ctx, 500, "failed to keystone_authenticate()"); |
There was a problem hiding this comment.
error conditions should halt execution. add a return here and after all ctx->set_error calls
Sorry, something went wrong.
There was a problem hiding this comment.
I will check all possible paths and fix these issues.
Sorry, something went wrong.
| } | ||
| } | ||
|
|
||
| mapcache_connection_pool_release_connection(ctx, pc); |
There was a problem hiding this comment.
This should be called before all exit paths (i.e. it is currently not called on error condition exits)
Sorry, something went wrong.
There was a problem hiding this comment.
Right, I'll need to check those as-well.
Sorry, something went wrong.
| * | ||
| * Project: MapServer | ||
| * Purpose: MapCache tile caching support file: swift cache backend. | ||
| * Author: Michael Downey and the MapServer team. |
There was a problem hiding this comment.
Is this the correct author?
Sorry, something went wrong.
There was a problem hiding this comment.
No 😅
Sorry, something went wrong.
…atus codes >= 400.
|
I updated the source code and now support keystone v3 API. With gdb, we got this stack trace: #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007fde75254801 in __GI_abort () at abort.c:79
#2 0x00007fde7529d897 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7fde753cab9a "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3 0x00007fde752a490a in malloc_printerr (str=str@entry=0x7fde753c8ed3 "realloc(): invalid next size") at malloc.c:5350
#4 0x00007fde752a99b4 in _int_realloc (av=av@entry=0x7fde5c000020, oldp=oldp@entry=0x7fde5c024080, oldsize=oldsize@entry=64, nb=nb@entry=64)
at malloc.c:4534
#5 0x00007fde752acf9b in __GI___libc_realloc (oldmem=0x7fde5c024090, bytes=56) at malloc.c:3230
#6 0x00007fde7719376e in swift_set_object () from /usr/lib/x86_64-linux-gnu/libmapcache.so.1
#7 0x00007fde7716fb62 in ?? () from /usr/lib/x86_64-linux-gnu/libmapcache.so.1
#8 0x00007fde77165f4e in mapcache_cache_tile_exists () from /usr/lib/x86_64-linux-gnu/libmapcache.so.1
#9 0x00005602271e7d7d in examine_tile ()
#10 0x00005602271e807b in cmd_recurse ()
#11 0x00005602271e866c in feed_worker ()
#12 0x00005602271e872b in ?? ()
#13 0x00007fde6dbb96db in start_thread (arg=0x7fde6257a700) at pthread_create.c:463
#14 0x00007fde7533588f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
This points to an issue in swift_set_object, where I basically duplicate a string (the re-allocation). From my perspective it looks clean but I'm suspecting, that there is some issue with connection pooling (construction, destruction), but I can't figure it out. Could you maybe have a look at it and tell me if I use the interfaces correctly? |
Sorry, something went wrong.
|
I think I found the issue, a classic buffer overflow (re-)allocating strlen bytes, but strcpy writes a final '\0' character out of the allocated area. This PR is good to go from my perspective. @tbonfort please let me know if need anything in addition. |
Sorry, something went wrong.
|
Have you figured out the causes of failed checks? |
Sorry, something went wrong.
|
Yes, I think I solved the issues |
Sorry, something went wrong.
|
I've checked your updates following @tbonfort's comments and it looks OK in my opinion. About licenses, I think there is nothing wrong with using LGPLv3 source code in a bigger MIT licensed project. I don't know the prefered way of mentioning it: copy license text at the beginning of related code (only swift-client.h and swift-client.c, since no license is mentioned in keystone-client repo), or include it in MapCache LICENSE file with a note indicating that only swift-client is concerned with LGPLv3. @jmckenna any advice on this? |
Sorry, something went wrong.
|
@jbo-ads I prefer the second option, but I think it should be noted in several places:
|
Sorry, something went wrong.
|
@constantinius - Please don't forget to update the documentation with this new feature: https://mapserver.org/mapcache/caches.html |
Sorry, something went wrong.
|
Unfortunately the latest commit breaks building for me: [ 95%] Linking C executable mapcache.fcgi cd /build/mapcache-1.10.0/obj-x86_64-linux-gnu/cgi && /usr/bin/cmake -E cmake_link_script CMakeFiles/mapcache.fcgi.dir/link.txt --verbose=1 /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/mapcache-1.10.0=. -fstack-protector-strong -Wformat -Werror=format-security -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wdate-time -D_FORTIFY_SOURCE=2 -Wall -Werror=declaration-after-statement -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -rdynamic CMakeFiles/mapcache.fcgi.dir/mapcache.c.o -o mapcache.fcgi -Wl,-rpath,/build/mapcache-1.10.0/obj-x86_64-linux-gnu: ../libmapcache.so.1.10.0 -lfcgi -lpng -lz -ljpeg -lcurl -lapr-1 -laprutil-1 -lpixman-1 -lgdal -lpcre -lsqlite3 -lpq -ltiff -ljson-c -ldl -lm ../libmapcache.so.1.10.0: undefined reference to `keystone_get_service_url' ../libmapcache.so.1.10.0: undefined reference to `keystone_set_auth_version' ../libmapcache.so.1.10.0: undefined reference to `keystone_start' ../libmapcache.so.1.10.0: undefined reference to `keystone_end' ../libmapcache.so.1.10.0: undefined reference to `keystone_authenticate' ../libmapcache.so.1.10.0: undefined reference to `keystone_get_auth_token' ../libmapcache.so.1.10.0: undefined reference to `keystone_set_debug' collect2: error: ld returned 1 exit status |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Adding OpenStack Swift cache backend using modified keystone-client and swift-client libraries.